Lo-Dash v1.2.1

A low-level utility library delivering consistency, customization, performance, and extra features.

_([1, 2, 3]).forEach(alert).join(',');
// → alerts each number and returns '1,2,3'

_.extend({ 'name': 'moe' }, { 'age': 40 });
// → { 'name': 'moe', 'age': 40 }

_.map([1, 2, 3], function(num) { return num * 3; });
// → [3, 6, 9]

Download v1.2.1

Who’s using Lo-Dash?

Dive in

We’ve got API docs, benchmarks, and unit tests.

Resources

For more information check out these articles, screencasts, and other videos over Lo-Dash:

Features

Support

Lo-Dash v1.2.1 has been tested in at least Chrome 5~26, Firefox 2~20, IE 6-10, Opera 9.25~12, Safari 3-6, Node.js 0.4.8-0.10.5, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5.

Custom builds

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. For a more detailed summary over the differences between various builds, check out the wiki page.

Custom builds may be created using the following commands:

All arguments, except legacy with mobile, modern, or underscore, may be combined.

Unless specified by -o or --output, all files created are saved to the current working directory.

The following options are also supported:

The lodash command-line utility is available when Lo-Dash is installed as a global package
(i.e. npm install -g lodash).

Installation and usage

In browsers:

<script src="lodash.js"></script>

Using npm:

npm install lodash

npm install -g lodash
npm link lodash

To avoid potential issues, update npm before installing Lo-Dash:

npm install npm -g

In Node.js and RingoJS v0.8.0+:

var _ = require('lodash');

// or as a drop-in replacement for Underscore
var _ = require('lodash/dist/lodash.underscore');

Note: If Lo-Dash is installed globally, run npm link lodash in your project’s root directory before requiring it.

In RingoJS v0.7.0-:

var _ = require('lodash')._;

In Rhino:

load('lodash.js');

In an AMD loader like RequireJS:

require({
  'paths': {
    'underscore': 'path/to/lodash'
  }
},
['underscore'], function(_) {
  console.log(_.VERSION);
});