Using underscore.js with node.js
Underscore.js:
Underscore is a JavaScript library that provides a whole mess of useful functional programming helpers without extending any built-in objects. It’s the answer to the question: “If I sit down in front of a blank HTML page, and want to start being productive immediately, what do I need?” … and the tie to go along with jQuery‘s tux andBackbone‘s suspenders.
Underscore provides over 100 functions that support both your favorite workaday functional helpers: map, filter, invoke — as well as more specialized goodies: function binding, javascript templating, creating quick indexes, deep equality testing, and so on.
Source: http://underscorejs.org/
To install underscore.js in a node.js project use: npm install underscore
After installing it you can use underscore now on your node.js project as : var _ = require(‘underscore’);
Things you can do with _ :
1. Merge two json objects:
var obj1 = {foo:”bar”};
var obj2 = {name:”john”};
var merged = _.extend(obj1,obj2);














