|
12 years ago | |
---|---|---|
.. | ||
dist | 12 years ago | |
README.md | 12 years ago | |
package.json | 12 years ago |
README.md
Lo-Dash v1.1.1
A utility library delivering consistency, customization, performance, & extras.
Download
-
Lo-Dash builds (for modern environments):
Development and Production -
Lo-Dash compatibility builds (for legacy and modern environments):
Development and Production -
Underscore compatibility builds:
Development and Production -
CDN copies of ≤ v1.1.1’s builds are available on cdnjs thanks to CloudFlare:
Lo-Dash dev, Lo-Dash prod,
Lo-Dash compat-dev, Lo-Dash compat-prod,
Underscore compat-dev, and Underscore compat-prod -
For optimal file size, create a custom build with only the features you need
Dive in
We’ve got API docs, benchmarks, and unit tests.
For a list of upcoming features, check out our roadmap.
Resources
For more information check out these articles, screencasts, and other videos over Lo-Dash:
- Posts
- Videos
- Introducing Lo-Dash
- Lo-Dash optimizations and custom builds
- Lo-Dash’s origin and why it’s a better utility belt
- Unit testing in Lo-Dash
- Lo-Dash’s approach to native method use
- CascadiaJS: Lo-Dash for a better utility belt
Features
- AMD loader support (RequireJS, curl.js, etc.)
- _(…) supports intuitive chaining
- _.at for cherry-picking collection values
- _.bindKey for binding “lazy” defined methods
- _.cloneDeep for deep cloning arrays and objects
- _.contains accepts a
fromIndex
argument - _.createCallback to customize how callback arguments are handled and support callback shorthands in mixins
- _.findIndex and _.findKey for finding indexes and keys of collections
- _.forEach is chainable and supports exiting iteration early
- _.forIn for iterating over an object’s own and inherited properties
- _.forOwn for iterating over an object’s own properties
- _.isPlainObject checks if values are created by the
Object
constructor - _.merge for a deep _.extend
- _.parseInt for consistent cross-environment behavior
- _.partial and _.partialRight for partial application without
this
binding - _.runInContext for easier mocking and extended environment support
- _.support to flag environment features
- _.template supports “imports” options, ES6 template delimiters, and sourceURLs
- _.where supports deep object comparisons
- _.clone, _.omit, _.pick,
and more… accept
callback
andthisArg
arguments - _.contains, _.size, _.toArray, and more… accept strings
- _.filter, _.find, _.map,
and more… support “_.pluck” and “_.where”
callback
shorthands
Support
Lo-Dash has been tested in at least Chrome 5~25, Firefox 2~19, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.10.1, Narwhal 0.3.2, PhantomJS 1.8.1, RingoJS 0.9, and Rhino 1.7RC5.
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);
});
Release Notes
v1.1.1
- Ensured the
underscore
build version of_.forEach
accepts athisArg
argument - Updated vendor/tar to work with Node v0.10.x
v1.1.0
- Added
rhino -require
support - Added
_.createCallback
,_findIndex
,_.findKey
,_.parseInt
,_.runInContext
, and_.support
- Added support for
callback
andthisArg
arguments to_.flatten
- Added CommonJS/Node support to precompiled templates
- Ensured the
exports
object is not a DOM element - Ensured
_.isPlainObject
returnsfalse
for objects without a[[Class]]
of “Object” - Made
_.cloneDeep
’scallback
support more closely follow its documentation - Made the template precompiler create nonexistent directories of
--output
paths - Made
_.object
an alias of_.zipObject
- Optimized method chaining, object iteration,
_.find
, and_.pluck
(an average of 18% overall better performance) - Updated
backbone
build Lo-Dash method dependencies
The full changelog is available here.
BestieJS
Lo-Dash is part of the BestieJS “Best in Class” module collection. This means we promote solid browser/environment support, ES5+ precedents, unit testing, and plenty of documentation.
Author
John-David Dalton |
Contributors
Blaine Bublitz | Kit Cambridge | Mathias Bynens |