Alternatives to underscore.js
I know this is old but did you look at lodash? From the site:
A drop-in replacement* for Underscore.js.[...]
Custom builds make it easy to create lightweight versions of Lo-Dash containing only the methods you need. To top it off, we handle all method dependency and alias mapping for you.
Take a look at lazy.js (http://dtao.github.io/lazy.js/) similar to underscore.js but with significant performance improvment due to lazy evaluation
It's called JavaScript arr.filter
, arr.sort
, arr.length
.
You can apply any array method on an array, popular ones are filter
, map
and reduce
, You can build more complex operations by combining those.
If you want to iterate over objects use
Object.keys(o).forEach(function (key) { var val = o[key]; ...});
underscore is useful if you live in an ES3 world, but ES5 has everything you need, all underscore does is add bloat on top of it.