4 ms·
Underscore.coffee
- m0th87 16y agoThis is the coffeescript version of underscore.js. BTW, these beautiful documentation webpages are auto-generated with a tool, as pointed out in the underscore.js post: http://news.ycombinator.com/item?id=1767897 http://news.ycombinator.com/item?id=1767897 There are equivalents for several languages.
- jashkenas 16y agoCautionary note: this version is slightly out of date, and needs to be updated to reflect the changes in Underscore 1.1.1 ...
- SupremumLimit 16y agoIt's probably worth noting that you can just use the original Underscore.js in your CoffeeScripts, which solves the problem with being out of date. Underscore.coffee is a good demo of CoffeeScript though.
- jasondavies 16y agoSomeone should write a JavaScript -> CoffeeScript converter. Shouldn't be too hard, I might actually do this myself when I get time.
- jrockway 16y agoI'm not really a fan of this literate coffeescript. Most of the code speaks for itself, and the English explanation make the code much harder to follow. It's worse than "add one to i" because at least that doesn't take up multiple lines.
- pjscott 16y agoThose English explanations are just the comments from the original JavaScript version, put in their own column. If anything, this avoids breaking the flow of the code itself.
- jashkenas 16y agoI agree that Underscore's functions are simple/short enough that the commentary doesn't add much. However, do you still think that literate-style documentation isn't helpful for more complicated modules like this one? http://sstephenson.github.com/strscan-js http://sstephenson.github.com/strscan-js Or, to take an extreme example -- this one: http://jashkenas.github.com/coffee-script/documentation/docs/rewriter.html http://jashkenas.github.com/coffee-script/documentation/docs... ... where the code is very detail-oriented, and you need the commentary to convey the "what", and the "why" -- while the code explains the "how".
- jrockway 16y agoLiterate programming is useful, but not when the commentary is "the function createMeAFoo creates me a foo".