You won’t believe the shocking truth about CoffeeScript’s named params
2015-05-02
CoffeeScript has named parameters. You can read about how to use them at this lovely guide to writing readable CoffeeScript. Unfortunately, they’re slightly broken.
method = (arg1, {foo, bar, baz}) -> console.log baz method('arg1', foo: 'foo', bar: 'bar', baz: 'baz') undefined Wait, what? Why does method print undefined?
If you use named parameters, and you split them across a newline and indent, everything after the newline won’t be captured in the named params!
Read more →