Reputation: 27206
I'm finding the CoffeeScript compiler baulks at this :
a = {'a':1,
'b': { 'b1':1, 'b2':2 }
}
Is that right? CoffeeScript can't create nested dictionaries?
Upvotes: 0
Views: 1201
Reputation: 37761
CoffeeScript is whitespace sensitive, even when using braces. Either don't use the braces as suggested by limelights, or ensure that the whitespace matches when using braces:
a = {
'a': 1,
'b': { 'b1': 1, 'b2': 2 }
}
Upvotes: 1
Reputation: 47202
Nested JavaScript objects or "dicts" is no match for the CS compiler.
a =
a: 1
b:
b1: 1
b2: 2
Produces this
a = {
a: 1,
b: {
b1: 1,
b2: 2
}
};
Upvotes: 2