7

I am building a node.js app and wondering which javascript lib to add to my repertoire. Current short list includes:

Bonus points for something that works in the browser (so I can use it on both client and server).

Any ideas? Advice? Opinions on the above? Something else I should investigate?

Elias Zamaria
  • 96,623
  • 33
  • 114
  • 148
Toby Hede
  • 36,755
  • 28
  • 133
  • 162
  • It kinda depends what you *need*. The three you mentioned all do the same with Functional.js having a few more utilities you might or might not use. – BGerrissen Sep 11 '10 at 10:02
  • Wu.js lazy initialisation methods is interresting, but imo. complicates matters a bit. It's a tradeoff, efficiency for simplicity. – BGerrissen Sep 11 '10 at 10:12
  • I guess the issue is that if the libraries all pretty much do the same thing, then the decision comes down to factors other than feature-set such as code quality and robustness. – Toby Hede Sep 12 '10 at 04:30
  • Another vote for underscore. We recently added it to our client code and have been loving it. – Charlie Flowers Dec 16 '10 at 07:24
  • @CharlieFlowers Underscore already comes with Wordpress, so chances are in many projects it is already included on the page. – NoBugs Jan 20 '16 at 03:00

1 Answers1

6

I really like underscore.js. I use it alongside async.js, which offers async-friendly versions of many of the same functions. Both of these work in node.js AND the browser, giving you some pretty powerful tools to use across all your code.

Caolan
  • 3,909
  • 1
  • 18
  • 8
  • 2
    Working with underscore at the moment and I actually kind-of wish the methods just worked on the core Array object rather than being namespaced to _() ... – Toby Hede Sep 12 '10 at 04:31
  • 1
    Toby -- if you want to extend Array.prototype, then keep an eye on what Prototype.js is up to. Word on the street is that the next version is going to be fully ECMA5 compliant. – jashkenas Sep 12 '10 at 23:31
  • For people coming late to this answer, make sure to review "Hey Underscore, You're Doing it Wrong!" (https://www.youtube.com/watch?v=m3svKOdZijA) to make sure you're comfortable with Underscore's idiosyncratic approach to functional programming. – Palpatim Sep 02 '14 at 21:03