The famous “underscore.js” library¶
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?”
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.
Learn more about it on the official Underscore.js web site.
Syncplify.me AFT! comes equipped out-of-the-box with the minified version of the underscore.js module. In order to use it you’ll need to require the module.
Example:
{
// Require the minified Underscore.js module
var _ = require("underscore-min");
// Let's use the "contains" function from the previously required Underscore.js module
if (_.contains([1, 2, 3], 3)) {
Log('Yay!');
}
}