3 ms·
(couldn't edit parent, so) Top 3 things tl;dr Paren-free chaining (think jQuery or d3): bar = svg.append 'rect' .attr 'fill', 'papayawhip' .a
by jashkenas 13y ago
(couldn't edit parent, so)
Top 3 things tl;dr
Paren-free chaining (think jQuery or d3):
bar = svg.append 'rect'
.attr 'fill', 'papayawhip'
.attr 'width', width
.attr 'height', 0
.attr 'y', height
.attr 'data-hover', data.slug
Ellipsis for soaking up matching parameters, even if you don't want to name a variable:
[first, ..., last] = arrayOfStuff
lastArgumentFn = (..., last) -> last
... and generally improved source maps.
- xixixao 13y agoAnd together with source maps significantly improved error reporting. I think that might be important for some people who struggled with CS's syntax.
- kaonashi 13y agoNice… I had been using '__', but it seems like this will allow you to use it multiple times in a parameter list.
- couchand 13y agoIt's even cooler than throwaway names [0]. You can index from the back: arr = [1, 2, 3] [..., two, three] = arr or look for node-style callbacks... myFun = (..., cb) -> cb() But you can't use it multiple times. That would allow for ambiguous syntax: # disallowed [..., whatAmI, ...] = [1, 2, 3, 4] [0] https://gist.github.com/aseemk/8637896#expansion-in-array-destructuring https://gist.github.com/aseemk/8637896#expansion-in-array-de...
- latchkey 13y ago...it also seems to compile a bit faster. for my project... 1.6.3 real 0m2.287s 1.7.0 real 0m1.655s