Add _.chain alias of _. [closes #267]

Former-commit-id: 580e4346444096c7fa77cfc5cf2c68b6cf891fcf
This commit is contained in:
John-David Dalton
2013-05-11 00:59:48 -07:00
parent 9bd0c01702
commit 5841e62c66
9 changed files with 56 additions and 28 deletions

13
dist/lodash.js vendored
View File

@@ -256,6 +256,7 @@
*
* @name _
* @constructor
* @alias chain
* @category Chaining
* @param {Mixed} value The value to wrap in a `lodash` instance.
* @returns {Object} Returns a `lodash` instance.
@@ -4299,13 +4300,16 @@
* });
*/
function memoize(func, resolver) {
var cache = {};
return function() {
var key = keyPrefix + (resolver ? resolver.apply(this, arguments) : arguments[0]);
function memoized() {
var cache = memoized.cache,
key = keyPrefix + (resolver ? resolver.apply(this, arguments) : arguments[0]);
return hasOwnProperty.call(cache, key)
? cache[key]
: (cache[key] = func.apply(this, arguments));
};
}
memoized.cache = {};
return memoized;
}
/**
@@ -5056,6 +5060,7 @@
lodash.zipObject = zipObject;
// add aliases
lodash.chain = lodash;
lodash.collect = map;
lodash.drop = rest;
lodash.each = forEach;