News for hackers. Stuff that matters.
Re:Underscore.js: Annotated Source Code by moron4hire on Thursday October 07, 2010 @10:35AM (#1767949)
This is just a style comment, but given JavaScript's open class prototypes and expando objects, I generally prefer to write these methods as new members on their natural classes. For example, the RegEx escape method would be on the RegEx class itself, rather than being a stand alone function.

Other than that, this is an incredibly useful set of functions that any JavaScript developer should have in their toolkit.

Re:Underscore.js: Annotated Source Code by rtp on Friday October 08, 2010 @09:26AM (#1771548)
You mean like putting the methods into the native classes' prototypes? That's a bad idea. The reason why it is a bad idea is that you cannot extend a prototype only within a scope, i.e if you change the prototype, it'll be changed regardless of whether it'll break another library, or that another library replaces your methods and thus render your library broken. This opens up the risk that you'll end up with bugs that are hard to trace to their source.