CoffeeScriptRedux icon indicating copy to clipboard operation
CoffeeScriptRedux copied to clipboard

Object Literal Array Shorthand

Open DavidSouther opened this issue 11 years ago • 2 comments

In Redux, this does not compile:

arr = [
  animal: 'dog'
  sound: 'woof'
,
  animal: 'cat'
  sound: 'meow'
]

http://michaelficarra.github.io/CoffeeScriptRedux/#try:%0Aarr%20%3D%20%5B%0A%20%20animal%3A%20'dog'%0A%20%20sound%3A%20'woof'%0A%2C%0A%20%20animal%3A%20'cat'%0A%20%20sound%3A%20'meow'%0A%5D%0A

In CoffeeScript, it compiles to

var arr;
arr = [
  {
    animal: 'dog',
    sound: 'woof'
  }, {
    animal: 'cat',
    sound: 'meow'
  }
];

http://coffeescript.org/#try:arr%20%3D%20%5B%0A%20%20animal%3A%20'dog'%0A%20%20sound%3A%20'woof'%0A%2C%0A%20%20animal%3A%20'cat'%0A%20%20sound%3A%20'meow'%0A%5D%0A

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/1781147-object-literal-array-shorthand?utm_campaign=plugin&utm_content=tracker%2F33145&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F33145&utm_medium=issues&utm_source=github).

DavidSouther avatar Apr 22 '14 15:04 DavidSouther

Is there any plan to support this format?

cybertk avatar Sep 03 '14 05:09 cybertk

Yes, it must be supported for compatibility. I just haven't prioritised fixing it because I recommend against using this style.

michaelficarra avatar Sep 03 '14 16:09 michaelficarra