Compare commits

...

3 Commits

Author SHA1 Message Date
John-David Dalton
24a4285b70 Bump to v4.2.0. 2016-02-02 00:06:39 -08:00
John-David Dalton
bbd78fee4d Bump to v4.1.0. 2016-01-29 08:30:29 -08:00
John-David Dalton
d8d0500f37 Bump to v4.0.1. 2016-01-25 07:54:11 -08:00
808 changed files with 6682 additions and 1834 deletions

View File

@@ -1,34 +1,34 @@
# lodash v4.0.0 # lodash v4.2.0
The [lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules. The [lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules.
Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
```bash
$ lodash modularize exports=node -o ./
$ lodash -d -o ./lodash.js
```
## Installation ## Installation
Using npm: Using npm:
```bash ```bash
$ {sudo -H} npm i -g npm $ {sudo -H} npm i -g npm
$ npm i --save lodash $ npm i --save lodash
``` ```
In Node.js: In Node.js:
```js ```js
// load the modern build // load the full build
var _ = require('lodash'); var _ = require('lodash');
// load the core build
var _ = require('lodash/core');
// load the fp build for immutable auto-curried iteratee-first data-last methods
var _ = require('lodash/fp');
// or a method category // or a method category
var array = require('lodash/array'); var array = require('lodash/array');
// or a method (great for smaller builds with browserify/webpack) var object = require('lodash/fp/object');
// or method for smaller builds with browserify/rollup/webpack
var chunk = require('lodash/chunk'); var chunk = require('lodash/chunk');
var extend = require('lodash/fp/extend');
``` ```
See the [package source](https://github.com/lodash/lodash/tree/4.0.0-npm) for more details. See the [package source](https://github.com/lodash/lodash/tree/4.2.0-npm) for more details.
**Note:**<br> **Note:**<br>
Dont assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL.<br> Dont assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL.<br>
@@ -36,11 +36,11 @@ Install [n_](https://www.npmjs.com/package/n_) for a REPL that includes lodash b
## Module formats ## Module formats
lodash is also available in a variety of other builds & module formats. Lodash is available in a variety of other builds & module formats.
* [lodash](https://www.npmjs.com/package/lodash) & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) packages * [lodash](https://www.npmjs.com/package/lodash) & [per method packages](https://www.npmjs.com/browse/keyword/lodash-modularized)
* [lodash-amd](https://www.npmjs.com/package/lodash-amd) * [lodash-amd](https://www.npmjs.com/package/lodash-amd)
* [lodash-es](https://www.npmjs.com/package/lodash-es) * [lodash-es](https://www.npmjs.com/package/lodash-es) & [babel-plugin-lodash](https://www.npmjs.com/package/babel-plugin-lodash)
## Further Reading ## Further Reading
@@ -52,5 +52,5 @@ lodash is also available in a variety of other builds & module formats.
## Support ## Support
Tested in Chrome 46-47, Firefox 42-43, IE 9-11, Edge 13, Safari 8-9, Node.js 0.10.x, 0.12.x, 4.x, & 5.x, &amp; PhantomJS 1.9.8. Tested in Chrome 47-48, Firefox 43-44, IE 9-11, Edge 13, Safari 8-9, Node.js 0.10, 0.12, 4, & 5, & PhantomJS 1.9.8.
Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. Special thanks to [Sauce Labs](https://saucelabs.com/) for providing automated browser testing. Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. Special thanks to [Sauce Labs](https://saucelabs.com/) for providing automated browser testing.

View File

@@ -1,7 +1,7 @@
var nativeCreate = require('./nativeCreate'); var nativeCreate = require('./_nativeCreate');
/** Used for built-in method references. */ /** Used for built-in method references. */
var objectProto = global.Object.prototype; var objectProto = Object.prototype;
/** /**
* Creates an hash object. * Creates an hash object.

View File

@@ -1,5 +1,5 @@
var baseCreate = require('./baseCreate'), var baseCreate = require('./_baseCreate'),
baseLodash = require('./baseLodash'); baseLodash = require('./_baseLodash');
/** Used as references for the maximum length and index of an array. */ /** Used as references for the maximum length and index of an array. */
var MAX_ARRAY_LENGTH = 4294967295; var MAX_ARRAY_LENGTH = 4294967295;

View File

@@ -1,5 +1,5 @@
var baseCreate = require('./baseCreate'), var baseCreate = require('./_baseCreate'),
baseLodash = require('./baseLodash'); baseLodash = require('./_baseLodash');
/** /**
* The base constructor for creating `lodash` wrapper objects. * The base constructor for creating `lodash` wrapper objects.

7
_Map.js Normal file
View File

@@ -0,0 +1,7 @@
var getNative = require('./_getNative'),
root = require('./_root');
/* Built-in method references that are verified to be native. */
var Map = getNative(root, 'Map');
module.exports = Map;

View File

@@ -1,8 +1,8 @@
var mapClear = require('./mapClear'), var mapClear = require('./_mapClear'),
mapDelete = require('./mapDelete'), mapDelete = require('./_mapDelete'),
mapGet = require('./mapGet'), mapGet = require('./_mapGet'),
mapHas = require('./mapHas'), mapHas = require('./_mapHas'),
mapSet = require('./mapSet'); mapSet = require('./_mapSet');
/** /**
* Creates a map cache object to store key-value pairs. * Creates a map cache object to store key-value pairs.

View File

@@ -1,4 +1,6 @@
var root = require('./_root');
/** Built-in value references. */ /** Built-in value references. */
var Reflect = global.Reflect; var Reflect = root.Reflect;
module.exports = Reflect; module.exports = Reflect;

7
_Set.js Normal file
View File

@@ -0,0 +1,7 @@
var getNative = require('./_getNative'),
root = require('./_root');
/* Built-in method references that are verified to be native. */
var Set = getNative(root, 'Set');
module.exports = Set;

View File

@@ -1,5 +1,5 @@
var MapCache = require('./MapCache'), var MapCache = require('./_MapCache'),
cachePush = require('./cachePush'); cachePush = require('./_cachePush');
/** /**
* *

View File

@@ -1,8 +1,8 @@
var stackClear = require('./stackClear'), var stackClear = require('./_stackClear'),
stackDelete = require('./stackDelete'), stackDelete = require('./_stackDelete'),
stackGet = require('./stackGet'), stackGet = require('./_stackGet'),
stackHas = require('./stackHas'), stackHas = require('./_stackHas'),
stackSet = require('./stackSet'); stackSet = require('./_stackSet');
/** /**
* Creates a stack cache object to store key-value pairs. * Creates a stack cache object to store key-value pairs.

6
_Symbol.js Normal file
View File

@@ -0,0 +1,6 @@
var root = require('./_root');
/** Built-in value references. */
var Symbol = root.Symbol;
module.exports = Symbol;

6
_Uint8Array.js Normal file
View File

@@ -0,0 +1,6 @@
var root = require('./_root');
/** Built-in value references. */
var Uint8Array = root.Uint8Array;
module.exports = Uint8Array;

7
_WeakMap.js Normal file
View File

@@ -0,0 +1,7 @@
var getNative = require('./_getNative'),
root = require('./_root');
/* Built-in method references that are verified to be native. */
var WeakMap = getNative(root, 'WeakMap');
module.exports = WeakMap;

View File

@@ -5,11 +5,11 @@
* @private * @private
* @param {Function} func The function to invoke. * @param {Function} func The function to invoke.
* @param {*} thisArg The `this` binding of `func`. * @param {*} thisArg The `this` binding of `func`.
* @param {...*} [args] The arguments to invoke `func` with. * @param {...*} args The arguments to invoke `func` with.
* @returns {*} Returns the result of `func`. * @returns {*} Returns the result of `func`.
*/ */
function apply(func, thisArg, args) { function apply(func, thisArg, args) {
var length = args ? args.length : 0; var length = args.length;
switch (length) { switch (length) {
case 0: return func.call(thisArg); case 0: return func.call(thisArg);
case 1: return func.call(thisArg, args[0]); case 1: return func.call(thisArg, args[0]);

22
_arrayAggregator.js Normal file
View File

@@ -0,0 +1,22 @@
/**
* A specialized version of `baseAggregator` for arrays.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} setter The function to set `accumulator` values.
* @param {Function} iteratee The iteratee to transform keys.
* @param {Object} accumulator The initial aggregated object.
* @returns {Function} Returns `accumulator`.
*/
function arrayAggregator(array, setter, iteratee, accumulator) {
var index = -1,
length = array.length;
while (++index < length) {
var value = array[index];
setter(accumulator, value, iteratee(value), array);
}
return accumulator;
}
module.exports = arrayAggregator;

View File

@@ -1,4 +1,4 @@
var baseIndexOf = require('./baseIndexOf'); var baseIndexOf = require('./_baseIndexOf');
/** /**
* A specialized version of `_.includes` for arrays without support for * A specialized version of `_.includes` for arrays without support for

View File

@@ -6,14 +6,14 @@
* @param {Array} array The array to iterate over. * @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration. * @param {Function} iteratee The function invoked per iteration.
* @param {*} [accumulator] The initial value. * @param {*} [accumulator] The initial value.
* @param {boolean} [initFromArray] Specify using the first element of `array` as the initial value. * @param {boolean} [initAccum] Specify using the first element of `array` as the initial value.
* @returns {*} Returns the accumulated value. * @returns {*} Returns the accumulated value.
*/ */
function arrayReduce(array, iteratee, accumulator, initFromArray) { function arrayReduce(array, iteratee, accumulator, initAccum) {
var index = -1, var index = -1,
length = array.length; length = array.length;
if (initFromArray && length) { if (initAccum && length) {
accumulator = array[++index]; accumulator = array[++index];
} }
while (++index < length) { while (++index < length) {

View File

@@ -6,12 +6,12 @@
* @param {Array} array The array to iterate over. * @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration. * @param {Function} iteratee The function invoked per iteration.
* @param {*} [accumulator] The initial value. * @param {*} [accumulator] The initial value.
* @param {boolean} [initFromArray] Specify using the last element of `array` as the initial value. * @param {boolean} [initAccum] Specify using the last element of `array` as the initial value.
* @returns {*} Returns the accumulated value. * @returns {*} Returns the accumulated value.
*/ */
function arrayReduceRight(array, iteratee, accumulator, initFromArray) { function arrayReduceRight(array, iteratee, accumulator, initAccum) {
var length = array.length; var length = array.length;
if (initFromArray && length) { if (initAccum && length) {
accumulator = array[--length]; accumulator = array[--length];
} }
while (length--) { while (length--) {

View File

@@ -1,7 +1,7 @@
var eq = require('../eq'); var eq = require('./eq');
/** Used for built-in method references. */ /** Used for built-in method references. */
var objectProto = global.Object.prototype; var objectProto = Object.prototype;
/** Used to check objects for own properties. */ /** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty; var hasOwnProperty = objectProto.hasOwnProperty;

View File

@@ -1,4 +1,4 @@
var eq = require('../eq'); var eq = require('./eq');
/** /**
* This function is like `assignValue` except that it doesn't assign `undefined` values. * This function is like `assignValue` except that it doesn't assign `undefined` values.

View File

@@ -1,7 +1,7 @@
var eq = require('../eq'); var eq = require('./eq');
/** Used for built-in method references. */ /** Used for built-in method references. */
var objectProto = global.Object.prototype; var objectProto = Object.prototype;
/** Used to check objects for own properties. */ /** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty; var hasOwnProperty = objectProto.hasOwnProperty;

View File

@@ -1,7 +1,7 @@
var assocIndexOf = require('./assocIndexOf'); var assocIndexOf = require('./_assocIndexOf');
/** Used for built-in method references. */ /** Used for built-in method references. */
var arrayProto = global.Array.prototype; var arrayProto = Array.prototype;
/** Built-in value references. */ /** Built-in value references. */
var splice = arrayProto.splice; var splice = arrayProto.splice;

View File

@@ -1,4 +1,4 @@
var assocIndexOf = require('./assocIndexOf'); var assocIndexOf = require('./_assocIndexOf');
/** /**
* Gets the associative array value for `key`. * Gets the associative array value for `key`.

View File

@@ -1,4 +1,4 @@
var assocIndexOf = require('./assocIndexOf'); var assocIndexOf = require('./_assocIndexOf');
/** /**
* Checks if an associative array value for `key` exists. * Checks if an associative array value for `key` exists.

View File

@@ -1,4 +1,4 @@
var eq = require('../eq'); var eq = require('./eq');
/** /**
* Gets the index at which the first occurrence of `key` is found in `array` * Gets the index at which the first occurrence of `key` is found in `array`

View File

@@ -1,4 +1,4 @@
var assocIndexOf = require('./assocIndexOf'); var assocIndexOf = require('./_assocIndexOf');
/** /**
* Sets the associative array `key` to `value`. * Sets the associative array `key` to `value`.

21
_baseAggregator.js Normal file
View File

@@ -0,0 +1,21 @@
var baseEach = require('./_baseEach');
/**
* Aggregates elements of `collection` on `accumulator` with keys transformed
* by `iteratee` and values set by `setter`.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} setter The function to set `accumulator` values.
* @param {Function} iteratee The iteratee to transform keys.
* @param {Object} accumulator The initial aggregated object.
* @returns {Function} Returns `accumulator`.
*/
function baseAggregator(collection, setter, iteratee, accumulator) {
baseEach(collection, function(value, key, collection) {
setter(accumulator, value, iteratee(value), collection);
});
return accumulator;
}
module.exports = baseAggregator;

View File

@@ -1,5 +1,5 @@
var copyObject = require('./copyObject'), var copyObject = require('./_copyObject'),
keys = require('../keys'); keys = require('./keys');
/** /**
* The base implementation of `_.assign` without support for multiple sources * The base implementation of `_.assign` without support for multiple sources

View File

@@ -1,4 +1,4 @@
var get = require('../get'); var get = require('./get');
/** /**
* The base implementation of `_.at` without support for individual paths. * The base implementation of `_.at` without support for individual paths.

View File

@@ -1,17 +1,17 @@
var Stack = require('./Stack'), var Stack = require('./_Stack'),
arrayEach = require('./arrayEach'), arrayEach = require('./_arrayEach'),
assignValue = require('./assignValue'), assignValue = require('./_assignValue'),
baseAssign = require('./baseAssign'), baseAssign = require('./_baseAssign'),
baseForOwn = require('./baseForOwn'), baseForOwn = require('./_baseForOwn'),
copyArray = require('./copyArray'), copyArray = require('./_copyArray'),
copySymbols = require('./copySymbols'), copySymbols = require('./_copySymbols'),
getTag = require('./getTag'), getTag = require('./_getTag'),
initCloneArray = require('./initCloneArray'), initCloneArray = require('./_initCloneArray'),
initCloneByTag = require('./initCloneByTag'), initCloneByTag = require('./_initCloneByTag'),
initCloneObject = require('./initCloneObject'), initCloneObject = require('./_initCloneObject'),
isArray = require('../isArray'), isArray = require('./isArray'),
isHostObject = require('./isHostObject'), isHostObject = require('./_isHostObject'),
isObject = require('../isObject'); isObject = require('./isObject');
/** `Object#toString` result references. */ /** `Object#toString` result references. */
var argsTag = '[object Arguments]', var argsTag = '[object Arguments]',

View File

@@ -1,4 +1,4 @@
var keys = require('../keys'); var keys = require('./keys');
/** /**
* The base implementation of `_.conforms` which doesn't clone `source`. * The base implementation of `_.conforms` which doesn't clone `source`.

View File

@@ -1,4 +1,4 @@
var isObject = require('../isObject'); var isObject = require('./isObject');
/** /**
* The base implementation of `_.create` without support for assigning * The base implementation of `_.create` without support for assigning

View File

@@ -1,9 +1,9 @@
var SetCache = require('./SetCache'), var SetCache = require('./_SetCache'),
arrayIncludes = require('./arrayIncludes'), arrayIncludes = require('./_arrayIncludes'),
arrayIncludesWith = require('./arrayIncludesWith'), arrayIncludesWith = require('./_arrayIncludesWith'),
arrayMap = require('./arrayMap'), arrayMap = require('./_arrayMap'),
baseUnary = require('./baseUnary'), baseUnary = require('./_baseUnary'),
cacheHas = require('./cacheHas'); cacheHas = require('./_cacheHas');
/** Used as the size to enable large array optimizations. */ /** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200; var LARGE_ARRAY_SIZE = 200;

View File

@@ -1,5 +1,5 @@
var baseForOwn = require('./baseForOwn'), var baseForOwn = require('./_baseForOwn'),
createBaseEach = require('./createBaseEach'); createBaseEach = require('./_createBaseEach');
/** /**
* The base implementation of `_.forEach` without support for iteratee shorthands. * The base implementation of `_.forEach` without support for iteratee shorthands.

View File

@@ -1,5 +1,5 @@
var baseForOwnRight = require('./baseForOwnRight'), var baseForOwnRight = require('./_baseForOwnRight'),
createBaseEach = require('./createBaseEach'); createBaseEach = require('./_createBaseEach');
/** /**
* The base implementation of `_.forEachRight` without support for iteratee shorthands. * The base implementation of `_.forEachRight` without support for iteratee shorthands.

View File

@@ -1,4 +1,4 @@
var baseEach = require('./baseEach'); var baseEach = require('./_baseEach');
/** /**
* The base implementation of `_.every` without support for iteratee shorthands. * The base implementation of `_.every` without support for iteratee shorthands.

View File

@@ -1,5 +1,5 @@
var toInteger = require('../toInteger'), var toInteger = require('./toInteger'),
toLength = require('../toLength'); toLength = require('./toLength');
/** /**
* The base implementation of `_.fill` without an iteratee call guard. * The base implementation of `_.fill` without an iteratee call guard.

View File

@@ -1,4 +1,4 @@
var baseEach = require('./baseEach'); var baseEach = require('./_baseEach');
/** /**
* The base implementation of `_.filter` without support for iteratee shorthands. * The base implementation of `_.filter` without support for iteratee shorthands.

View File

@@ -1,7 +1,7 @@
/** /**
* The base implementation of methods like `_.find` and `_.findKey`, without * The base implementation of methods like `_.find` and `_.findKey`, without
* support for iteratee shorthands, which iterates over `collection` using * support for iteratee shorthands, which iterates over `collection` using
* the provided `eachFunc`. * `eachFunc`.
* *
* @private * @private
* @param {Array|Object} collection The collection to search. * @param {Array|Object} collection The collection to search.

View File

@@ -1,7 +1,7 @@
var arrayPush = require('./arrayPush'), var arrayPush = require('./_arrayPush'),
isArguments = require('../isArguments'), isArguments = require('./isArguments'),
isArray = require('../isArray'), isArray = require('./isArray'),
isArrayLikeObject = require('../isArrayLikeObject'); isArrayLikeObject = require('./isArrayLikeObject');
/** /**
* The base implementation of `_.flatten` with support for restricting flattening. * The base implementation of `_.flatten` with support for restricting flattening.

View File

@@ -1,4 +1,4 @@
var createBaseFor = require('./createBaseFor'); var createBaseFor = require('./_createBaseFor');
/** /**
* The base implementation of `baseForIn` and `baseForOwn` which iterates * The base implementation of `baseForIn` and `baseForOwn` which iterates

View File

@@ -1,5 +1,5 @@
var baseFor = require('./baseFor'), var baseFor = require('./_baseFor'),
keysIn = require('../keysIn'); keysIn = require('./keysIn');
/** /**
* The base implementation of `_.forIn` without support for iteratee shorthands. * The base implementation of `_.forIn` without support for iteratee shorthands.

View File

@@ -1,5 +1,5 @@
var baseFor = require('./baseFor'), var baseFor = require('./_baseFor'),
keys = require('../keys'); keys = require('./keys');
/** /**
* The base implementation of `_.forOwn` without support for iteratee shorthands. * The base implementation of `_.forOwn` without support for iteratee shorthands.

View File

@@ -1,5 +1,5 @@
var baseForRight = require('./baseForRight'), var baseForRight = require('./_baseForRight'),
keys = require('../keys'); keys = require('./keys');
/** /**
* The base implementation of `_.forOwnRight` without support for iteratee shorthands. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.

View File

@@ -1,4 +1,4 @@
var createBaseFor = require('./createBaseFor'); var createBaseFor = require('./_createBaseFor');
/** /**
* This function is like `baseFor` except that it iterates over properties * This function is like `baseFor` except that it iterates over properties

View File

@@ -1,5 +1,5 @@
var arrayFilter = require('./arrayFilter'), var arrayFilter = require('./_arrayFilter'),
isFunction = require('../isFunction'); isFunction = require('./isFunction');
/** /**
* The base implementation of `_.functions` which creates an array of * The base implementation of `_.functions` which creates an array of

View File

@@ -1,5 +1,5 @@
var baseToPath = require('./baseToPath'), var baseToPath = require('./_baseToPath'),
isKey = require('./isKey'); isKey = require('./_isKey');
/** /**
* The base implementation of `_.get` without support for default values. * The base implementation of `_.get` without support for default values.

View File

@@ -1,5 +1,5 @@
/** Used for built-in method references. */ /** Used for built-in method references. */
var objectProto = global.Object.prototype; var objectProto = Object.prototype;
/** Used to check objects for own properties. */ /** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty; var hasOwnProperty = objectProto.hasOwnProperty;

View File

@@ -1,4 +1,4 @@
var indexOfNaN = require('./indexOfNaN'); var indexOfNaN = require('./_indexOfNaN');
/** /**
* The base implementation of `_.indexOf` without `fromIndex` bounds checks. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.

View File

@@ -1,9 +1,9 @@
var SetCache = require('./SetCache'), var SetCache = require('./_SetCache'),
arrayIncludes = require('./arrayIncludes'), arrayIncludes = require('./_arrayIncludes'),
arrayIncludesWith = require('./arrayIncludesWith'), arrayIncludesWith = require('./_arrayIncludesWith'),
arrayMap = require('./arrayMap'), arrayMap = require('./_arrayMap'),
baseUnary = require('./baseUnary'), baseUnary = require('./_baseUnary'),
cacheHas = require('./cacheHas'); cacheHas = require('./_cacheHas');
/** /**
* The base implementation of methods like `_.intersection`, without support * The base implementation of methods like `_.intersection`, without support

21
_baseInverter.js Normal file
View File

@@ -0,0 +1,21 @@
var baseForOwn = require('./_baseForOwn');
/**
* The base implementation of `_.invert` and `_.invertBy` which inverts
* `object` with values transformed by `iteratee` and set by `setter`.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} setter The function to set `accumulator` values.
* @param {Function} iteratee The iteratee to transform values.
* @param {Object} accumulator The initial inverted object.
* @returns {Function} Returns `accumulator`.
*/
function baseInverter(object, setter, iteratee, accumulator) {
baseForOwn(object, function(value, key, object) {
setter(accumulator, iteratee(value), key, object);
});
return accumulator;
}
module.exports = baseInverter;

View File

@@ -1,14 +1,13 @@
var apply = require('./apply'), var apply = require('./_apply'),
baseToPath = require('./baseToPath'), baseToPath = require('./_baseToPath'),
isKey = require('./isKey'), isKey = require('./_isKey'),
last = require('../last'), last = require('./last'),
parent = require('./parent'); parent = require('./_parent');
/** /**
* The base implementation of `_.invoke` without support for individual * The base implementation of `_.invoke` without support for individual
* method arguments. * method arguments.
* *
*
* @private * @private
* @param {Object} object The object to query. * @param {Object} object The object to query.
* @param {Array|string} path The path of the method to invoke. * @param {Array|string} path The path of the method to invoke.

View File

@@ -1,6 +1,6 @@
var baseIsEqualDeep = require('./baseIsEqualDeep'), var baseIsEqualDeep = require('./_baseIsEqualDeep'),
isObject = require('../isObject'), isObject = require('./isObject'),
isObjectLike = require('../isObjectLike'); isObjectLike = require('./isObjectLike');
/** /**
* The base implementation of `_.isEqual` which supports partial comparisons * The base implementation of `_.isEqual` which supports partial comparisons

View File

@@ -1,11 +1,11 @@
var Stack = require('./Stack'), var Stack = require('./_Stack'),
equalArrays = require('./equalArrays'), equalArrays = require('./_equalArrays'),
equalByTag = require('./equalByTag'), equalByTag = require('./_equalByTag'),
equalObjects = require('./equalObjects'), equalObjects = require('./_equalObjects'),
getTag = require('./getTag'), getTag = require('./_getTag'),
isArray = require('../isArray'), isArray = require('./isArray'),
isHostObject = require('./isHostObject'), isHostObject = require('./_isHostObject'),
isTypedArray = require('../isTypedArray'); isTypedArray = require('./isTypedArray');
/** Used to compose bitmasks for comparison styles. */ /** Used to compose bitmasks for comparison styles. */
var PARTIAL_COMPARE_FLAG = 2; var PARTIAL_COMPARE_FLAG = 2;
@@ -16,7 +16,7 @@ var argsTag = '[object Arguments]',
objectTag = '[object Object]'; objectTag = '[object Object]';
/** Used for built-in method references. */ /** Used for built-in method references. */
var objectProto = global.Object.prototype; var objectProto = Object.prototype;
/** Used to check objects for own properties. */ /** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty; var hasOwnProperty = objectProto.hasOwnProperty;

View File

@@ -1,5 +1,5 @@
var Stack = require('./Stack'), var Stack = require('./_Stack'),
baseIsEqual = require('./baseIsEqual'); baseIsEqual = require('./_baseIsEqual');
/** Used to compose bitmasks for comparison styles. */ /** Used to compose bitmasks for comparison styles. */
var UNORDERED_COMPARE_FLAG = 1, var UNORDERED_COMPARE_FLAG = 1,
@@ -47,7 +47,10 @@ function baseIsMatch(object, source, matchData, customizer) {
var stack = new Stack, var stack = new Stack,
result = customizer ? customizer(objValue, srcValue, key, object, source, stack) : undefined; result = customizer ? customizer(objValue, srcValue, key, object, source, stack) : undefined;
if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result)) { if (!(result === undefined
? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)
: result
)) {
return false; return false;
} }
} }

View File

@@ -1,8 +1,8 @@
var baseMatches = require('./baseMatches'), var baseMatches = require('./_baseMatches'),
baseMatchesProperty = require('./baseMatchesProperty'), baseMatchesProperty = require('./_baseMatchesProperty'),
identity = require('../identity'), identity = require('./identity'),
isArray = require('../isArray'), isArray = require('./isArray'),
property = require('../property'); property = require('./property');
/** /**
* The base implementation of `_.iteratee`. * The base implementation of `_.iteratee`.

View File

@@ -1,8 +1,8 @@
var Reflect = require('./Reflect'), var Reflect = require('./_Reflect'),
iteratorToArray = require('./iteratorToArray'); iteratorToArray = require('./_iteratorToArray');
/** Used for built-in method references. */ /** Used for built-in method references. */
var objectProto = global.Object.prototype; var objectProto = Object.prototype;
/** Built-in value references. */ /** Built-in value references. */
var enumerate = Reflect ? Reflect.enumerate : undefined, var enumerate = Reflect ? Reflect.enumerate : undefined,

View File

@@ -1,5 +1,5 @@
var baseEach = require('./baseEach'), var baseEach = require('./_baseEach'),
isArrayLike = require('../isArrayLike'); isArrayLike = require('./isArrayLike');
/** /**
* The base implementation of `_.map` without support for iteratee shorthands. * The base implementation of `_.map` without support for iteratee shorthands.

View File

@@ -1,5 +1,5 @@
var baseIsMatch = require('./baseIsMatch'), var baseIsMatch = require('./_baseIsMatch'),
getMatchData = require('./getMatchData'); getMatchData = require('./_getMatchData');
/** /**
* The base implementation of `_.matches` which doesn't clone `source`. * The base implementation of `_.matches` which doesn't clone `source`.

View File

@@ -1,6 +1,6 @@
var baseIsEqual = require('./baseIsEqual'), var baseIsEqual = require('./_baseIsEqual'),
get = require('../get'), get = require('./get'),
hasIn = require('../hasIn'); hasIn = require('./hasIn');
/** Used to compose bitmasks for comparison styles. */ /** Used to compose bitmasks for comparison styles. */
var UNORDERED_COMPARE_FLAG = 1, var UNORDERED_COMPARE_FLAG = 1,

View File

@@ -1,11 +1,11 @@
var Stack = require('./Stack'), var Stack = require('./_Stack'),
arrayEach = require('./arrayEach'), arrayEach = require('./_arrayEach'),
assignMergeValue = require('./assignMergeValue'), assignMergeValue = require('./_assignMergeValue'),
baseMergeDeep = require('./baseMergeDeep'), baseMergeDeep = require('./_baseMergeDeep'),
isArray = require('../isArray'), isArray = require('./isArray'),
isObject = require('../isObject'), isObject = require('./isObject'),
isTypedArray = require('../isTypedArray'), isTypedArray = require('./isTypedArray'),
keysIn = require('../keysIn'); keysIn = require('./keysIn');
/** /**
* The base implementation of `_.merge` without support for multiple sources. * The base implementation of `_.merge` without support for multiple sources.
@@ -13,10 +13,11 @@ var Stack = require('./Stack'),
* @private * @private
* @param {Object} object The destination object. * @param {Object} object The destination object.
* @param {Object} source The source object. * @param {Object} source The source object.
* @param {number} srcIndex The index of `source`.
* @param {Function} [customizer] The function to customize merged values. * @param {Function} [customizer] The function to customize merged values.
* @param {Object} [stack] Tracks traversed source values and their merged counterparts. * @param {Object} [stack] Tracks traversed source values and their merged counterparts.
*/ */
function baseMerge(object, source, customizer, stack) { function baseMerge(object, source, srcIndex, customizer, stack) {
if (object === source) { if (object === source) {
return; return;
} }
@@ -28,7 +29,7 @@ function baseMerge(object, source, customizer, stack) {
} }
if (isObject(srcValue)) { if (isObject(srcValue)) {
stack || (stack = new Stack); stack || (stack = new Stack);
baseMergeDeep(object, source, key, baseMerge, customizer, stack); baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
} }
else { else {
var newValue = customizer ? customizer(object[key], srcValue, (key + ''), object, source, stack) : undefined; var newValue = customizer ? customizer(object[key], srcValue, (key + ''), object, source, stack) : undefined;

78
_baseMergeDeep.js Normal file
View File

@@ -0,0 +1,78 @@
var assignMergeValue = require('./_assignMergeValue'),
baseClone = require('./_baseClone'),
copyArray = require('./_copyArray'),
isArguments = require('./isArguments'),
isArray = require('./isArray'),
isArrayLikeObject = require('./isArrayLikeObject'),
isFunction = require('./isFunction'),
isObject = require('./isObject'),
isPlainObject = require('./isPlainObject'),
isTypedArray = require('./isTypedArray'),
toPlainObject = require('./toPlainObject');
/**
* A specialized version of `baseMerge` for arrays and objects which performs
* deep merges and tracks traversed objects enabling objects with circular
* references to be merged.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {string} key The key of the value to merge.
* @param {number} srcIndex The index of `source`.
* @param {Function} mergeFunc The function to merge values.
* @param {Function} [customizer] The function to customize assigned values.
* @param {Object} [stack] Tracks traversed source values and their merged counterparts.
*/
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
var objValue = object[key],
srcValue = source[key],
stacked = stack.get(srcValue);
if (stacked) {
assignMergeValue(object, key, stacked);
return;
}
var newValue = customizer ? customizer(objValue, srcValue, (key + ''), object, source, stack) : undefined,
isCommon = newValue === undefined;
if (isCommon) {
newValue = srcValue;
if (isArray(srcValue) || isTypedArray(srcValue)) {
if (isArray(objValue)) {
newValue = srcIndex ? copyArray(objValue) : objValue;
}
else if (isArrayLikeObject(objValue)) {
newValue = copyArray(objValue);
}
else {
isCommon = false;
newValue = baseClone(srcValue);
}
}
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
if (isArguments(objValue)) {
newValue = toPlainObject(objValue);
}
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
isCommon = false;
newValue = baseClone(srcValue);
}
else {
newValue = srcIndex ? baseClone(objValue) : objValue;
}
}
else {
isCommon = false;
}
}
stack.set(srcValue, newValue);
if (isCommon) {
// Recursively merge objects and arrays (susceptible to call stack limits).
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
}
assignMergeValue(object, key, newValue);
}
module.exports = baseMergeDeep;

View File

@@ -1,8 +1,8 @@
var arrayMap = require('./arrayMap'), var arrayMap = require('./_arrayMap'),
baseIteratee = require('./baseIteratee'), baseIteratee = require('./_baseIteratee'),
baseMap = require('./baseMap'), baseMap = require('./_baseMap'),
baseSortBy = require('./baseSortBy'), baseSortBy = require('./_baseSortBy'),
compareMultiple = require('./compareMultiple'); compareMultiple = require('./_compareMultiple');
/** /**
* The base implementation of `_.orderBy` without param guards. * The base implementation of `_.orderBy` without param guards.

View File

@@ -1,4 +1,4 @@
var arrayReduce = require('./arrayReduce'); var arrayReduce = require('./_arrayReduce');
/** /**
* The base implementation of `_.pick` without support for individual * The base implementation of `_.pick` without support for individual

View File

@@ -1,4 +1,4 @@
var baseForIn = require('./baseForIn'); var baseForIn = require('./_baseForIn');
/** /**
* The base implementation of `_.pickBy` without support for iteratee shorthands. * The base implementation of `_.pickBy` without support for iteratee shorthands.
@@ -11,7 +11,7 @@ var baseForIn = require('./baseForIn');
function basePickBy(object, predicate) { function basePickBy(object, predicate) {
var result = {}; var result = {};
baseForIn(object, function(value, key) { baseForIn(object, function(value, key) {
if (predicate(value)) { if (predicate(value, key)) {
result[key] = value; result[key] = value;
} }
}); });

View File

@@ -1,4 +1,4 @@
var baseGet = require('./baseGet'); var baseGet = require('./_baseGet');
/** /**
* A specialized version of `baseProperty` which supports deep paths. * A specialized version of `baseProperty` which supports deep paths.

View File

@@ -1,4 +1,4 @@
var basePullAllBy = require('./basePullAllBy'); var basePullAllBy = require('./_basePullAllBy');
/** /**
* The base implementation of `_.pullAll`. * The base implementation of `_.pullAll`.

View File

@@ -1,8 +1,8 @@
var arrayMap = require('./arrayMap'), var arrayMap = require('./_arrayMap'),
baseIndexOf = require('./baseIndexOf'); baseIndexOf = require('./_baseIndexOf');
/** Used for built-in method references. */ /** Used for built-in method references. */
var arrayProto = global.Array.prototype; var arrayProto = Array.prototype;
/** Built-in value references. */ /** Built-in value references. */
var splice = arrayProto.splice; var splice = arrayProto.splice;

View File

@@ -1,11 +1,11 @@
var baseToPath = require('./baseToPath'), var baseToPath = require('./_baseToPath'),
isIndex = require('./isIndex'), isIndex = require('./_isIndex'),
isKey = require('./isKey'), isKey = require('./_isKey'),
last = require('../last'), last = require('./last'),
parent = require('./parent'); parent = require('./_parent');
/** Used for built-in method references. */ /** Used for built-in method references. */
var arrayProto = global.Array.prototype; var arrayProto = Array.prototype;
/** Built-in value references. */ /** Built-in value references. */
var splice = arrayProto.splice; var splice = arrayProto.splice;

View File

@@ -1,20 +1,19 @@
/** /**
* The base implementation of `_.reduce` and `_.reduceRight`, without support * The base implementation of `_.reduce` and `_.reduceRight`, without support
* for iteratee shorthands, which iterates over `collection` using the provided * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
* `eachFunc`.
* *
* @private * @private
* @param {Array|Object} collection The collection to iterate over. * @param {Array|Object} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration. * @param {Function} iteratee The function invoked per iteration.
* @param {*} accumulator The initial value. * @param {*} accumulator The initial value.
* @param {boolean} initFromCollection Specify using the first or last element of `collection` as the initial value. * @param {boolean} initAccum Specify using the first or last element of `collection` as the initial value.
* @param {Function} eachFunc The function to iterate over `collection`. * @param {Function} eachFunc The function to iterate over `collection`.
* @returns {*} Returns the accumulated value. * @returns {*} Returns the accumulated value.
*/ */
function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) { function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
eachFunc(collection, function(value, index, collection) { eachFunc(collection, function(value, index, collection) {
accumulator = initFromCollection accumulator = initAccum
? (initFromCollection = false, value) ? (initAccum = false, value)
: iteratee(accumulator, value, index, collection); : iteratee(accumulator, value, index, collection);
}); });
return accumulator; return accumulator;

View File

@@ -1,8 +1,8 @@
var assignValue = require('./assignValue'), var assignValue = require('./_assignValue'),
baseToPath = require('./baseToPath'), baseToPath = require('./_baseToPath'),
isIndex = require('./isIndex'), isIndex = require('./_isIndex'),
isKey = require('./isKey'), isKey = require('./_isKey'),
isObject = require('../isObject'); isObject = require('./isObject');
/** /**
* The base implementation of `_.set`. * The base implementation of `_.set`.

View File

@@ -1,5 +1,5 @@
var identity = require('../identity'), var identity = require('./identity'),
metaMap = require('./metaMap'); metaMap = require('./_metaMap');
/** /**
* The base implementation of `setData` without support for hot loop detection. * The base implementation of `setData` without support for hot loop detection.

View File

@@ -1,4 +1,4 @@
var baseEach = require('./baseEach'); var baseEach = require('./_baseEach');
/** /**
* The base implementation of `_.some` without support for iteratee shorthands. * The base implementation of `_.some` without support for iteratee shorthands.

View File

@@ -1,5 +1,5 @@
var baseSortedIndexBy = require('./baseSortedIndexBy'), var baseSortedIndexBy = require('./_baseSortedIndexBy'),
identity = require('../identity'); identity = require('./identity');
/** Used as references for the maximum length and index of an array. */ /** Used as references for the maximum length and index of an array. */
var MAX_ARRAY_LENGTH = 4294967295, var MAX_ARRAY_LENGTH = 4294967295,

View File

@@ -1,4 +1,4 @@
var baseSortedUniqBy = require('./baseSortedUniqBy'); var baseSortedUniqBy = require('./_baseSortedUniqBy');
/** /**
* The base implementation of `_.sortedUniq`. * The base implementation of `_.sortedUniq`.

Some files were not shown because too many files have changed in this diff Show More