mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 16:47:49 +00:00
Compare commits
9 Commits
4.6.0-amd
...
4.11.2-amd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ccdfca5392 | ||
|
|
29c408ee8a | ||
|
|
63d9a3fc42 | ||
|
|
76b289fe6e | ||
|
|
57f1942947 | ||
|
|
8349627be6 | ||
|
|
a2438ffc51 | ||
|
|
d46bcaa98d | ||
|
|
6c2960211f |
60
LICENSE
60
LICENSE
@@ -1,23 +1,47 @@
|
|||||||
The MIT License (MIT)
|
Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
||||||
|
|
||||||
Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
|
Based on Underscore.js, copyright Jeremy Ashkenas,
|
||||||
Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas,
|
|
||||||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
This software consists of voluntary contributions made by many
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
individuals. For exact contribution history, see the revision history
|
||||||
in the Software without restriction, including without limitation the rights
|
available at https://github.com/lodash/lodash
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
The following license applies to all parts of this software except as
|
||||||
copies or substantial portions of the Software.
|
documented below:
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
====
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
a copy of this software and associated documentation files (the
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
"Software"), to deal in the Software without restriction, including
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
SOFTWARE.
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
====
|
||||||
|
|
||||||
|
Copyright and related rights for sample code are waived via CC0. Sample
|
||||||
|
code is defined as all source code displayed within the prose of the
|
||||||
|
documentation.
|
||||||
|
|
||||||
|
CC0: http://creativecommons.org/publicdomain/zero/1.0/
|
||||||
|
|
||||||
|
====
|
||||||
|
|
||||||
|
Files located in the node_modules and vendor directories are externally
|
||||||
|
maintained libraries used by this software which have their own
|
||||||
|
licenses; we recommend you read them, as their terms may differ from the
|
||||||
|
terms above.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# lodash-amd v4.6.0
|
# lodash-amd v4.11.2
|
||||||
|
|
||||||
The [lodash](https://lodash.com/) library exported as [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules.
|
The [Lodash](https://lodash.com/) library exported as [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules.
|
||||||
|
|
||||||
Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
|
Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
|
||||||
```bash
|
```bash
|
||||||
@@ -27,4 +27,4 @@ require({
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
See the [package source](https://github.com/lodash/lodash/tree/4.6.0-amd) for more details.
|
See the [package source](https://github.com/lodash/lodash/tree/4.11.2-amd) for more details.
|
||||||
|
|||||||
7
_DataView.js
Normal file
7
_DataView.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
define(['./_getNative', './_root'], function(getNative, root) {
|
||||||
|
|
||||||
|
/* Built-in method references that are verified to be native. */
|
||||||
|
var DataView = getNative(root, 'DataView');
|
||||||
|
|
||||||
|
return DataView;
|
||||||
|
});
|
||||||
2
_Hash.js
2
_Hash.js
@@ -4,7 +4,7 @@ define(['./_nativeCreate'], function(nativeCreate) {
|
|||||||
var objectProto = Object.prototype;
|
var objectProto = Object.prototype;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an hash object.
|
* Creates a hash object.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @constructor
|
* @constructor
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ define(['./_baseCreate', './_baseLodash'], function(baseCreate, baseLodash) {
|
|||||||
this.__views__ = [];
|
this.__views__ = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure `LazyWrapper` is an instance of `baseLodash`.
|
||||||
LazyWrapper.prototype = baseCreate(baseLodash.prototype);
|
LazyWrapper.prototype = baseCreate(baseLodash.prototype);
|
||||||
LazyWrapper.prototype.constructor = LazyWrapper;
|
LazyWrapper.prototype.constructor = LazyWrapper;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ define(['./_baseCreate', './_baseLodash'], function(baseCreate, baseLodash) {
|
|||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {*} value The value to wrap.
|
* @param {*} value The value to wrap.
|
||||||
* @param {boolean} [chainAll] Enable chaining for all wrapper methods.
|
* @param {boolean} [chainAll] Enable explicit method chain sequences.
|
||||||
*/
|
*/
|
||||||
function LodashWrapper(value, chainAll) {
|
function LodashWrapper(value, chainAll) {
|
||||||
this.__wrapped__ = value;
|
this.__wrapped__ = value;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ define(['./_mapClear', './_mapDelete', './_mapGet', './_mapHas', './_mapSet'], f
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add functions to the `MapCache`.
|
// Add methods to `MapCache`.
|
||||||
MapCache.prototype.clear = mapClear;
|
MapCache.prototype.clear = mapClear;
|
||||||
MapCache.prototype['delete'] = mapDelete;
|
MapCache.prototype['delete'] = mapDelete;
|
||||||
MapCache.prototype.get = mapGet;
|
MapCache.prototype.get = mapGet;
|
||||||
|
|||||||
7
_Promise.js
Normal file
7
_Promise.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
define(['./_getNative', './_root'], function(getNative, root) {
|
||||||
|
|
||||||
|
/* Built-in method references that are verified to be native. */
|
||||||
|
var Promise = getNative(root, 'Promise');
|
||||||
|
|
||||||
|
return Promise;
|
||||||
|
});
|
||||||
@@ -18,7 +18,7 @@ define(['./_MapCache', './_cachePush'], function(MapCache, cachePush) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add functions to the `SetCache`.
|
// Add methods to `SetCache`.
|
||||||
SetCache.prototype.push = cachePush;
|
SetCache.prototype.push = cachePush;
|
||||||
|
|
||||||
return SetCache;
|
return SetCache;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ define(['./_stackClear', './_stackDelete', './_stackGet', './_stackHas', './_sta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add functions to the `Stack` cache.
|
// Add methods to `Stack`.
|
||||||
Stack.prototype.clear = stackClear;
|
Stack.prototype.clear = stackClear;
|
||||||
Stack.prototype['delete'] = stackDelete;
|
Stack.prototype['delete'] = stackDelete;
|
||||||
Stack.prototype.get = stackGet;
|
Stack.prototype.get = stackGet;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ define([], function() {
|
|||||||
* @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 {Array} 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) {
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ define([], function() {
|
|||||||
* @private
|
* @private
|
||||||
* @param {Array} array The array to iterate over.
|
* @param {Array} array The array to iterate over.
|
||||||
* @param {Function} predicate The function invoked per iteration.
|
* @param {Function} predicate The function invoked per iteration.
|
||||||
* @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`.
|
* @returns {boolean} Returns `true` if all elements pass the predicate check,
|
||||||
|
* else `false`.
|
||||||
*/
|
*/
|
||||||
function arrayEvery(array, predicate) {
|
function arrayEvery(array, predicate) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ define([], function() {
|
|||||||
* @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} [initAccum] 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, initAccum) {
|
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ define([], function() {
|
|||||||
* @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} [initAccum] 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, initAccum) {
|
function arrayReduceRight(array, iteratee, accumulator, initAccum) {
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ define([], function() {
|
|||||||
* @private
|
* @private
|
||||||
* @param {Array} array The array to iterate over.
|
* @param {Array} array The array to iterate over.
|
||||||
* @param {Function} predicate The function invoked per iteration.
|
* @param {Function} predicate The function invoked per iteration.
|
||||||
* @returns {boolean} Returns `true` if any element passes the predicate check, else `false`.
|
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
||||||
|
* else `false`.
|
||||||
*/
|
*/
|
||||||
function arraySome(array, predicate) {
|
function arraySome(array, predicate) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ define(['./_assocIndexOf'], function(assocIndexOf) {
|
|||||||
* Removes `key` and its value from the associative array.
|
* Removes `key` and its value from the associative array.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Array} array The array to query.
|
* @param {Array} array The array to modify.
|
||||||
* @param {string} key The key of the value to remove.
|
* @param {string} key The key of the value to remove.
|
||||||
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
define(['./eq'], function(eq) {
|
define(['./eq'], function(eq) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the index at which the first occurrence of `key` is found in `array`
|
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
||||||
* of key-value pairs.
|
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Array} array The array to search.
|
* @param {Array} array The array to search.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_Stack', './_arrayEach', './_assignValue', './_baseAssign', './_baseForOwn', './_cloneBuffer', './_copyArray', './_copySymbols', './_getTag', './_initCloneArray', './_initCloneByTag', './_initCloneObject', './isArray', './isBuffer', './_isHostObject', './isObject'], function(Stack, arrayEach, assignValue, baseAssign, baseForOwn, cloneBuffer, copyArray, copySymbols, getTag, initCloneArray, initCloneByTag, initCloneObject, isArray, isBuffer, isHostObject, isObject) {
|
define(['./_Stack', './_arrayEach', './_assignValue', './_baseAssign', './_cloneBuffer', './_copyArray', './_copySymbols', './_getAllKeys', './_getTag', './_initCloneArray', './_initCloneByTag', './_initCloneObject', './isArray', './isBuffer', './_isHostObject', './isObject', './keys'], function(Stack, arrayEach, assignValue, baseAssign, cloneBuffer, copyArray, copySymbols, getAllKeys, getTag, initCloneArray, initCloneByTag, initCloneObject, isArray, isBuffer, isHostObject, isObject, keys) {
|
||||||
|
|
||||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
var undefined;
|
var undefined;
|
||||||
@@ -21,6 +21,7 @@ define(['./_Stack', './_arrayEach', './_assignValue', './_baseAssign', './_baseF
|
|||||||
weakMapTag = '[object WeakMap]';
|
weakMapTag = '[object WeakMap]';
|
||||||
|
|
||||||
var arrayBufferTag = '[object ArrayBuffer]',
|
var arrayBufferTag = '[object ArrayBuffer]',
|
||||||
|
dataViewTag = '[object DataView]',
|
||||||
float32Tag = '[object Float32Array]',
|
float32Tag = '[object Float32Array]',
|
||||||
float64Tag = '[object Float64Array]',
|
float64Tag = '[object Float64Array]',
|
||||||
int8Tag = '[object Int8Array]',
|
int8Tag = '[object Int8Array]',
|
||||||
@@ -34,16 +35,16 @@ define(['./_Stack', './_arrayEach', './_assignValue', './_baseAssign', './_baseF
|
|||||||
/** Used to identify `toStringTag` values supported by `_.clone`. */
|
/** Used to identify `toStringTag` values supported by `_.clone`. */
|
||||||
var cloneableTags = {};
|
var cloneableTags = {};
|
||||||
cloneableTags[argsTag] = cloneableTags[arrayTag] =
|
cloneableTags[argsTag] = cloneableTags[arrayTag] =
|
||||||
cloneableTags[arrayBufferTag] = cloneableTags[boolTag] =
|
cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
|
||||||
cloneableTags[dateTag] = cloneableTags[float32Tag] =
|
cloneableTags[boolTag] = cloneableTags[dateTag] =
|
||||||
cloneableTags[float64Tag] = cloneableTags[int8Tag] =
|
cloneableTags[float32Tag] = cloneableTags[float64Tag] =
|
||||||
cloneableTags[int16Tag] = cloneableTags[int32Tag] =
|
cloneableTags[int8Tag] = cloneableTags[int16Tag] =
|
||||||
cloneableTags[mapTag] = cloneableTags[numberTag] =
|
cloneableTags[int32Tag] = cloneableTags[mapTag] =
|
||||||
cloneableTags[objectTag] = cloneableTags[regexpTag] =
|
cloneableTags[numberTag] = cloneableTags[objectTag] =
|
||||||
cloneableTags[setTag] = cloneableTags[stringTag] =
|
cloneableTags[regexpTag] = cloneableTags[setTag] =
|
||||||
cloneableTags[symbolTag] = cloneableTags[uint8Tag] =
|
cloneableTags[stringTag] = cloneableTags[symbolTag] =
|
||||||
cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] =
|
cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
|
||||||
cloneableTags[uint32Tag] = true;
|
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
|
||||||
cloneableTags[errorTag] = cloneableTags[funcTag] =
|
cloneableTags[errorTag] = cloneableTags[funcTag] =
|
||||||
cloneableTags[weakMapTag] = false;
|
cloneableTags[weakMapTag] = false;
|
||||||
|
|
||||||
@@ -54,13 +55,14 @@ define(['./_Stack', './_arrayEach', './_assignValue', './_baseAssign', './_baseF
|
|||||||
* @private
|
* @private
|
||||||
* @param {*} value The value to clone.
|
* @param {*} value The value to clone.
|
||||||
* @param {boolean} [isDeep] Specify a deep clone.
|
* @param {boolean} [isDeep] Specify a deep clone.
|
||||||
|
* @param {boolean} [isFull] Specify a clone including symbols.
|
||||||
* @param {Function} [customizer] The function to customize cloning.
|
* @param {Function} [customizer] The function to customize cloning.
|
||||||
* @param {string} [key] The key of `value`.
|
* @param {string} [key] The key of `value`.
|
||||||
* @param {Object} [object] The parent object of `value`.
|
* @param {Object} [object] The parent object of `value`.
|
||||||
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
|
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
|
||||||
* @returns {*} Returns the cloned value.
|
* @returns {*} Returns the cloned value.
|
||||||
*/
|
*/
|
||||||
function baseClone(value, isDeep, customizer, key, object, stack) {
|
function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
|
||||||
var result;
|
var result;
|
||||||
if (customizer) {
|
if (customizer) {
|
||||||
result = object ? customizer(value, key, object, stack) : customizer(value);
|
result = object ? customizer(value, key, object, stack) : customizer(value);
|
||||||
@@ -96,7 +98,7 @@ define(['./_Stack', './_arrayEach', './_assignValue', './_baseAssign', './_baseF
|
|||||||
if (!cloneableTags[tag]) {
|
if (!cloneableTags[tag]) {
|
||||||
return object ? value : {};
|
return object ? value : {};
|
||||||
}
|
}
|
||||||
result = initCloneByTag(value, tag, isDeep);
|
result = initCloneByTag(value, tag, baseClone, isDeep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check for circular references and return its corresponding clone.
|
// Check for circular references and return its corresponding clone.
|
||||||
@@ -107,11 +109,18 @@ define(['./_Stack', './_arrayEach', './_assignValue', './_baseAssign', './_baseF
|
|||||||
}
|
}
|
||||||
stack.set(value, result);
|
stack.set(value, result);
|
||||||
|
|
||||||
|
if (!isArr) {
|
||||||
|
var props = isFull ? getAllKeys(value) : keys(value);
|
||||||
|
}
|
||||||
// Recursively populate clone (susceptible to call stack limits).
|
// Recursively populate clone (susceptible to call stack limits).
|
||||||
(isArr ? arrayEach : baseForOwn)(value, function(subValue, key) {
|
arrayEach(props || value, function(subValue, key) {
|
||||||
assignValue(result, key, baseClone(subValue, isDeep, customizer, key, value, stack));
|
if (props) {
|
||||||
|
key = subValue;
|
||||||
|
subValue = value[key];
|
||||||
|
}
|
||||||
|
assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
|
||||||
});
|
});
|
||||||
return isArr ? result : copySymbols(value, result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseClone;
|
return baseClone;
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ define(['./keys'], function(keys) {
|
|||||||
predicate = source[key],
|
predicate = source[key],
|
||||||
value = object[key];
|
value = object[key];
|
||||||
|
|
||||||
if ((value === undefined && !(key in Object(object))) || !predicate(value)) {
|
if ((value === undefined &&
|
||||||
|
!(key in Object(object))) || !predicate(value)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ define(['./_SetCache', './_arrayIncludes', './_arrayIncludesWith', './_arrayMap'
|
|||||||
var LARGE_ARRAY_SIZE = 200;
|
var LARGE_ARRAY_SIZE = 200;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of methods like `_.difference` without support for
|
* The base implementation of methods like `_.difference` without support
|
||||||
* excluding multiple arrays or iteratee shorthands.
|
* for excluding multiple arrays or iteratee shorthands.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Array} array The array to inspect.
|
* @param {Array} array The array to inspect.
|
||||||
@@ -42,6 +42,7 @@ define(['./_SetCache', './_arrayIncludes', './_arrayIncludesWith', './_arrayMap'
|
|||||||
var value = array[index],
|
var value = array[index],
|
||||||
computed = iteratee ? iteratee(value) : value;
|
computed = iteratee ? iteratee(value) : value;
|
||||||
|
|
||||||
|
value = (comparator || value !== 0) ? value : 0;
|
||||||
if (isCommon && computed === computed) {
|
if (isCommon && computed === computed) {
|
||||||
var valuesIndex = valuesLength;
|
var valuesIndex = valuesLength;
|
||||||
while (valuesIndex--) {
|
while (valuesIndex--) {
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ define(['./_baseEach'], function(baseEach) {
|
|||||||
* @private
|
* @private
|
||||||
* @param {Array|Object} collection The collection to iterate over.
|
* @param {Array|Object} collection The collection to iterate over.
|
||||||
* @param {Function} predicate The function invoked per iteration.
|
* @param {Function} predicate The function invoked per iteration.
|
||||||
* @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`
|
* @returns {boolean} Returns `true` if all elements pass the predicate check,
|
||||||
|
* else `false`
|
||||||
*/
|
*/
|
||||||
function baseEvery(collection, predicate) {
|
function baseEvery(collection, predicate) {
|
||||||
var result = true;
|
var result = true;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define([], function() {
|
define(['./isSymbol'], function(isSymbol) {
|
||||||
|
|
||||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
var undefined;
|
var undefined;
|
||||||
@@ -22,7 +22,7 @@ define([], function() {
|
|||||||
current = iteratee(value);
|
current = iteratee(value);
|
||||||
|
|
||||||
if (current != null && (computed === undefined
|
if (current != null && (computed === undefined
|
||||||
? current === current
|
? (current === current && !isSymbol(current))
|
||||||
: comparator(current, computed)
|
: comparator(current, computed)
|
||||||
)) {
|
)) {
|
||||||
var computed = current,
|
var computed = current,
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ define([], function() {
|
|||||||
* @param {Array|Object} collection The collection to search.
|
* @param {Array|Object} collection The collection to search.
|
||||||
* @param {Function} predicate The function invoked per iteration.
|
* @param {Function} predicate The function invoked per iteration.
|
||||||
* @param {Function} eachFunc The function to iterate over `collection`.
|
* @param {Function} eachFunc The function to iterate over `collection`.
|
||||||
* @param {boolean} [retKey] Specify returning the key of the found element instead of the element itself.
|
* @param {boolean} [retKey] Specify returning the key of the found element
|
||||||
|
* instead of the element itself.
|
||||||
* @returns {*} Returns the found element or its key, else `undefined`.
|
* @returns {*} Returns the found element or its key, else `undefined`.
|
||||||
*/
|
*/
|
||||||
function baseFind(collection, predicate, eachFunc, retKey) {
|
function baseFind(collection, predicate, eachFunc, retKey) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_arrayPush', './isArguments', './isArray', './isArrayLikeObject'], function(arrayPush, isArguments, isArray, isArrayLikeObject) {
|
define(['./_arrayPush', './_isFlattenable'], function(arrayPush, isFlattenable) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.flatten` with support for restricting flattening.
|
* The base implementation of `_.flatten` with support for restricting flattening.
|
||||||
@@ -6,23 +6,24 @@ define(['./_arrayPush', './isArguments', './isArray', './isArrayLikeObject'], fu
|
|||||||
* @private
|
* @private
|
||||||
* @param {Array} array The array to flatten.
|
* @param {Array} array The array to flatten.
|
||||||
* @param {number} depth The maximum recursion depth.
|
* @param {number} depth The maximum recursion depth.
|
||||||
* @param {boolean} [isStrict] Restrict flattening to arrays-like objects.
|
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
|
||||||
|
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
|
||||||
* @param {Array} [result=[]] The initial result value.
|
* @param {Array} [result=[]] The initial result value.
|
||||||
* @returns {Array} Returns the new flattened array.
|
* @returns {Array} Returns the new flattened array.
|
||||||
*/
|
*/
|
||||||
function baseFlatten(array, depth, isStrict, result) {
|
function baseFlatten(array, depth, predicate, isStrict, result) {
|
||||||
result || (result = []);
|
|
||||||
|
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = array.length;
|
length = array.length;
|
||||||
|
|
||||||
|
predicate || (predicate = isFlattenable);
|
||||||
|
result || (result = []);
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
var value = array[index];
|
var value = array[index];
|
||||||
if (depth > 0 && isArrayLikeObject(value) &&
|
if (depth > 0 && predicate(value)) {
|
||||||
(isStrict || isArray(value) || isArguments(value))) {
|
|
||||||
if (depth > 1) {
|
if (depth > 1) {
|
||||||
// Recursively flatten arrays (susceptible to call stack limits).
|
// Recursively flatten arrays (susceptible to call stack limits).
|
||||||
baseFlatten(value, depth - 1, isStrict, result);
|
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
||||||
} else {
|
} else {
|
||||||
arrayPush(result, value);
|
arrayPush(result, value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
define(['./_createBaseFor'], function(createBaseFor) {
|
define(['./_createBaseFor'], function(createBaseFor) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `baseForIn` and `baseForOwn` which iterates
|
* The base implementation of `baseForOwn` which iterates over `object`
|
||||||
* over `object` properties returned by `keysFunc` invoking `iteratee` for
|
* properties returned by `keysFunc` and invokes `iteratee` for each property.
|
||||||
* each property. Iteratee functions may exit iteration early by explicitly
|
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
||||||
* returning `false`.
|
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Object} object The object to iterate over.
|
* @param {Object} object The object to iterate over.
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
define(['./_baseFor', './keysIn'], function(baseFor, keysIn) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `_.forIn` without support for iteratee shorthands.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} object The object to iterate over.
|
|
||||||
* @param {Function} iteratee The function invoked per iteration.
|
|
||||||
* @returns {Object} Returns `object`.
|
|
||||||
*/
|
|
||||||
function baseForIn(object, iteratee) {
|
|
||||||
return object == null ? object : baseFor(object, iteratee, keysIn);
|
|
||||||
}
|
|
||||||
|
|
||||||
return baseForIn;
|
|
||||||
});
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_baseCastPath', './_isKey'], function(baseCastPath, isKey) {
|
define(['./_castPath', './_isKey', './_toKey'], function(castPath, isKey, toKey) {
|
||||||
|
|
||||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
var undefined;
|
var undefined;
|
||||||
@@ -12,13 +12,13 @@ define(['./_baseCastPath', './_isKey'], function(baseCastPath, isKey) {
|
|||||||
* @returns {*} Returns the resolved value.
|
* @returns {*} Returns the resolved value.
|
||||||
*/
|
*/
|
||||||
function baseGet(object, path) {
|
function baseGet(object, path) {
|
||||||
path = isKey(path, object) ? [path + ''] : baseCastPath(path);
|
path = isKey(path, object) ? [path] : castPath(path);
|
||||||
|
|
||||||
var index = 0,
|
var index = 0,
|
||||||
length = path.length;
|
length = path.length;
|
||||||
|
|
||||||
while (object != null && index < length) {
|
while (object != null && index < length) {
|
||||||
object = object[path[index++]];
|
object = object[toKey(path[index++])];
|
||||||
}
|
}
|
||||||
return (index && index == length) ? object : undefined;
|
return (index && index == length) ? object : undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
22
_baseGetAllKeys.js
Normal file
22
_baseGetAllKeys.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
define(['./_arrayPush', './isArray'], function(arrayPush, isArray) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
|
||||||
|
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
|
||||||
|
* symbols of `object`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Object} object The object to query.
|
||||||
|
* @param {Function} keysFunc The function to get the keys of `object`.
|
||||||
|
* @param {Function} symbolsFunc The function to get the symbols of `object`.
|
||||||
|
* @returns {Array} Returns the array of property names and symbols.
|
||||||
|
*/
|
||||||
|
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
||||||
|
var result = keysFunc(object);
|
||||||
|
return isArray(object)
|
||||||
|
? result
|
||||||
|
: arrayPush(result, symbolsFunc(object));
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseGetAllKeys;
|
||||||
|
});
|
||||||
17
_baseGt.js
Normal file
17
_baseGt.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
define([], function() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base implementation of `_.gt` which doesn't coerce arguments to numbers.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {*} value The value to compare.
|
||||||
|
* @param {*} other The other value to compare.
|
||||||
|
* @returns {boolean} Returns `true` if `value` is greater than `other`,
|
||||||
|
* else `false`.
|
||||||
|
*/
|
||||||
|
function baseGt(value, other) {
|
||||||
|
return value > other;
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseGt;
|
||||||
|
});
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
define([], function() {
|
define(['./_getPrototype'], function(getPrototype) {
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
/** Used for built-in method references. */
|
||||||
var objectProto = Object.prototype;
|
var objectProto = Object.prototype;
|
||||||
@@ -6,9 +6,6 @@ define([], function() {
|
|||||||
/** Used to check objects for own properties. */
|
/** Used to check objects for own properties. */
|
||||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||||
|
|
||||||
/** Built-in value references. */
|
|
||||||
var getPrototypeOf = Object.getPrototypeOf;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.has` without support for deep paths.
|
* The base implementation of `_.has` without support for deep paths.
|
||||||
*
|
*
|
||||||
@@ -22,7 +19,7 @@ define([], function() {
|
|||||||
// that are composed entirely of index properties, return `false` for
|
// that are composed entirely of index properties, return `false` for
|
||||||
// `hasOwnProperty` checks of them.
|
// `hasOwnProperty` checks of them.
|
||||||
return hasOwnProperty.call(object, key) ||
|
return hasOwnProperty.call(object, key) ||
|
||||||
(typeof object == 'object' && key in object && getPrototypeOf(object) === null);
|
(typeof object == 'object' && key in object && getPrototype(object) === null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseHas;
|
return baseHas;
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ define(['./_SetCache', './_arrayIncludes', './_arrayIncludesWith', './_arrayMap'
|
|||||||
var value = array[index],
|
var value = array[index],
|
||||||
computed = iteratee ? iteratee(value) : value;
|
computed = iteratee ? iteratee(value) : value;
|
||||||
|
|
||||||
|
value = (comparator || value !== 0) ? value : 0;
|
||||||
if (!(seen
|
if (!(seen
|
||||||
? cacheHas(seen, computed)
|
? cacheHas(seen, computed)
|
||||||
: includes(result, computed, comparator)
|
: includes(result, computed, comparator)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_apply', './_baseCastPath', './_isKey', './last', './_parent'], function(apply, baseCastPath, isKey, last, parent) {
|
define(['./_apply', './_castPath', './_isKey', './last', './_parent', './_toKey'], function(apply, castPath, isKey, last, parent, toKey) {
|
||||||
|
|
||||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
var undefined;
|
var undefined;
|
||||||
@@ -15,11 +15,11 @@ define(['./_apply', './_baseCastPath', './_isKey', './last', './_parent'], funct
|
|||||||
*/
|
*/
|
||||||
function baseInvoke(object, path, args) {
|
function baseInvoke(object, path, args) {
|
||||||
if (!isKey(path, object)) {
|
if (!isKey(path, object)) {
|
||||||
path = baseCastPath(path);
|
path = castPath(path);
|
||||||
object = parent(object, path);
|
object = parent(object, path);
|
||||||
path = last(path);
|
path = last(path);
|
||||||
}
|
}
|
||||||
var func = object == null ? object : object[path];
|
var func = object == null ? object : object[toKey(path)];
|
||||||
return func == null ? undefined : apply(func, object, args);
|
return func == null ? undefined : apply(func, object, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ define(['./_Stack', './_equalArrays', './_equalByTag', './_equalObjects', './_ge
|
|||||||
* @param {Object} other The other object to compare.
|
* @param {Object} other The other object to compare.
|
||||||
* @param {Function} equalFunc The function to determine equivalents of values.
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
||||||
* @param {Function} [customizer] The function to customize comparisons.
|
* @param {Function} [customizer] The function to customize comparisons.
|
||||||
* @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details.
|
* @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
|
||||||
|
* for more details.
|
||||||
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
|
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
|
||||||
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
||||||
*/
|
*/
|
||||||
@@ -57,8 +58,11 @@ define(['./_Stack', './_equalArrays', './_equalByTag', './_equalObjects', './_ge
|
|||||||
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
||||||
|
|
||||||
if (objIsWrapped || othIsWrapped) {
|
if (objIsWrapped || othIsWrapped) {
|
||||||
|
var objUnwrapped = objIsWrapped ? object.value() : object,
|
||||||
|
othUnwrapped = othIsWrapped ? other.value() : other;
|
||||||
|
|
||||||
stack || (stack = new Stack);
|
stack || (stack = new Stack);
|
||||||
return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, bitmask, stack);
|
return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isSameTag) {
|
if (!isSameTag) {
|
||||||
|
|||||||
@@ -46,9 +46,10 @@ define(['./_Stack', './_baseIsEqual'], function(Stack, baseIsEqual) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var stack = new Stack,
|
var stack = new Stack;
|
||||||
result = customizer ? customizer(objValue, srcValue, key, object, source, stack) : undefined;
|
if (customizer) {
|
||||||
|
var result = customizer(objValue, srcValue, key, object, source, stack);
|
||||||
|
}
|
||||||
if (!(result === undefined
|
if (!(result === undefined
|
||||||
? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)
|
? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)
|
||||||
: result
|
: result
|
||||||
|
|||||||
@@ -8,14 +8,15 @@ define(['./_baseMatches', './_baseMatchesProperty', './identity', './isArray', '
|
|||||||
* @returns {Function} Returns the iteratee.
|
* @returns {Function} Returns the iteratee.
|
||||||
*/
|
*/
|
||||||
function baseIteratee(value) {
|
function baseIteratee(value) {
|
||||||
var type = typeof value;
|
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
|
||||||
if (type == 'function') {
|
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
|
||||||
|
if (typeof value == 'function') {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return identity;
|
return identity;
|
||||||
}
|
}
|
||||||
if (type == 'object') {
|
if (typeof value == 'object') {
|
||||||
return isArray(value)
|
return isArray(value)
|
||||||
? baseMatchesProperty(value[0], value[1])
|
? baseMatchesProperty(value[0], value[1])
|
||||||
: baseMatches(value);
|
: baseMatches(value);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
define([], function() {
|
define([], function() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The function whose prototype all chaining wrappers inherit from.
|
* The function whose prototype chain sequence wrappers inherit from.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
|
|||||||
17
_baseLt.js
Normal file
17
_baseLt.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
define([], function() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base implementation of `_.lt` which doesn't coerce arguments to numbers.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {*} value The value to compare.
|
||||||
|
* @param {*} other The other value to compare.
|
||||||
|
* @returns {boolean} Returns `true` if `value` is less than `other`,
|
||||||
|
* else `false`.
|
||||||
|
*/
|
||||||
|
function baseLt(value, other) {
|
||||||
|
return value < other;
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseLt;
|
||||||
|
});
|
||||||
@@ -1,7 +1,4 @@
|
|||||||
define(['./_baseIsMatch', './_getMatchData'], function(baseIsMatch, getMatchData) {
|
define(['./_baseIsMatch', './_getMatchData', './_matchesStrictComparable'], function(baseIsMatch, getMatchData, matchesStrictComparable) {
|
||||||
|
|
||||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
|
||||||
var undefined;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.matches` which doesn't clone `source`.
|
* The base implementation of `_.matches` which doesn't clone `source`.
|
||||||
@@ -13,16 +10,7 @@ define(['./_baseIsMatch', './_getMatchData'], function(baseIsMatch, getMatchData
|
|||||||
function baseMatches(source) {
|
function baseMatches(source) {
|
||||||
var matchData = getMatchData(source);
|
var matchData = getMatchData(source);
|
||||||
if (matchData.length == 1 && matchData[0][2]) {
|
if (matchData.length == 1 && matchData[0][2]) {
|
||||||
var key = matchData[0][0],
|
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
|
||||||
value = matchData[0][1];
|
|
||||||
|
|
||||||
return function(object) {
|
|
||||||
if (object == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return object[key] === value &&
|
|
||||||
(value !== undefined || (key in Object(object)));
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
return function(object) {
|
return function(object) {
|
||||||
return object === source || baseIsMatch(object, source, matchData);
|
return object === source || baseIsMatch(object, source, matchData);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_baseIsEqual', './get', './hasIn'], function(baseIsEqual, get, hasIn) {
|
define(['./_baseIsEqual', './get', './hasIn', './_isKey', './_isStrictComparable', './_matchesStrictComparable', './_toKey'], function(baseIsEqual, get, hasIn, isKey, isStrictComparable, matchesStrictComparable, toKey) {
|
||||||
|
|
||||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
var undefined;
|
var undefined;
|
||||||
@@ -16,6 +16,9 @@ define(['./_baseIsEqual', './get', './hasIn'], function(baseIsEqual, get, hasIn)
|
|||||||
* @returns {Function} Returns the new function.
|
* @returns {Function} Returns the new function.
|
||||||
*/
|
*/
|
||||||
function baseMatchesProperty(path, srcValue) {
|
function baseMatchesProperty(path, srcValue) {
|
||||||
|
if (isKey(path) && isStrictComparable(srcValue)) {
|
||||||
|
return matchesStrictComparable(toKey(path), srcValue);
|
||||||
|
}
|
||||||
return function(object) {
|
return function(object) {
|
||||||
var objValue = get(object, path);
|
var objValue = get(object, path);
|
||||||
return (objValue === undefined && objValue === srcValue)
|
return (objValue === undefined && objValue === srcValue)
|
||||||
|
|||||||
21
_baseMean.js
Normal file
21
_baseMean.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
define(['./_baseSum'], function(baseSum) {
|
||||||
|
|
||||||
|
/** Used as references for various `Number` constants. */
|
||||||
|
var NAN = 0 / 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base implementation of `_.mean` and `_.meanBy` without support for
|
||||||
|
* iteratee shorthands.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Array} array The array to iterate over.
|
||||||
|
* @param {Function} iteratee The function invoked per iteration.
|
||||||
|
* @returns {number} Returns the mean.
|
||||||
|
*/
|
||||||
|
function baseMean(array, iteratee) {
|
||||||
|
var length = array ? array.length : 0;
|
||||||
|
return length ? (baseSum(array, iteratee) / length) : NAN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseMean;
|
||||||
|
});
|
||||||
@@ -11,16 +11,16 @@ define(['./_Stack', './_arrayEach', './_assignMergeValue', './_baseMergeDeep', '
|
|||||||
* @param {Object} source The source object.
|
* @param {Object} source The source object.
|
||||||
* @param {number} srcIndex The index of `source`.
|
* @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, srcIndex, customizer, stack) {
|
function baseMerge(object, source, srcIndex, customizer, stack) {
|
||||||
if (object === source) {
|
if (object === source) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var props = (isArray(source) || isTypedArray(source))
|
if (!(isArray(source) || isTypedArray(source))) {
|
||||||
? undefined
|
var props = keysIn(source);
|
||||||
: keysIn(source);
|
}
|
||||||
|
|
||||||
arrayEach(props || source, function(srcValue, key) {
|
arrayEach(props || source, function(srcValue, key) {
|
||||||
if (props) {
|
if (props) {
|
||||||
key = srcValue;
|
key = srcValue;
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ define(['./_assignMergeValue', './_baseClone', './_copyArray', './isArguments',
|
|||||||
* @param {number} srcIndex The index of `source`.
|
* @param {number} srcIndex The index of `source`.
|
||||||
* @param {Function} mergeFunc The function to merge values.
|
* @param {Function} mergeFunc The function to merge values.
|
||||||
* @param {Function} [customizer] The function to customize assigned values.
|
* @param {Function} [customizer] The function to customize assigned values.
|
||||||
* @param {Object} [stack] Tracks traversed source values and their merged counterparts.
|
* @param {Object} [stack] Tracks traversed source values and their merged
|
||||||
|
* counterparts.
|
||||||
*/
|
*/
|
||||||
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
||||||
var objValue = object[key],
|
var objValue = object[key],
|
||||||
@@ -43,7 +44,7 @@ define(['./_assignMergeValue', './_baseClone', './_copyArray', './isArguments',
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
isCommon = false;
|
isCommon = false;
|
||||||
newValue = baseClone(srcValue, !customizer);
|
newValue = baseClone(srcValue, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
||||||
@@ -52,7 +53,7 @@ define(['./_assignMergeValue', './_baseClone', './_copyArray', './isArguments',
|
|||||||
}
|
}
|
||||||
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
|
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
|
||||||
isCommon = false;
|
isCommon = false;
|
||||||
newValue = baseClone(srcValue, !customizer);
|
newValue = baseClone(srcValue, true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
newValue = objValue;
|
newValue = objValue;
|
||||||
|
|||||||
24
_baseNth.js
Normal file
24
_baseNth.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
define(['./_isIndex'], function(isIndex) {
|
||||||
|
|
||||||
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
|
var undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base implementation of `_.nth` which doesn't coerce `n` to an integer.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Array} array The array to query.
|
||||||
|
* @param {number} n The index of the element to return.
|
||||||
|
* @returns {*} Returns the nth element of `array`.
|
||||||
|
*/
|
||||||
|
function baseNth(array, n) {
|
||||||
|
var length = array.length;
|
||||||
|
if (!length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
n += n < 0 ? length : 0;
|
||||||
|
return isIndex(n, length) ? array[n] : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseNth;
|
||||||
|
});
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_arrayMap', './_baseIteratee', './_baseMap', './_baseSortBy', './_compareMultiple'], function(arrayMap, baseIteratee, baseMap, baseSortBy, compareMultiple) {
|
define(['./_arrayMap', './_baseIteratee', './_baseMap', './_baseSortBy', './_baseUnary', './_compareMultiple', './identity'], function(arrayMap, baseIteratee, baseMap, baseSortBy, baseUnary, compareMultiple, identity) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.orderBy` without param guards.
|
* The base implementation of `_.orderBy` without param guards.
|
||||||
@@ -11,7 +11,7 @@ define(['./_arrayMap', './_baseIteratee', './_baseMap', './_baseSortBy', './_com
|
|||||||
*/
|
*/
|
||||||
function baseOrderBy(collection, iteratees, orders) {
|
function baseOrderBy(collection, iteratees, orders) {
|
||||||
var index = -1;
|
var index = -1;
|
||||||
iteratees = arrayMap(iteratees.length ? iteratees : Array(1), baseIteratee);
|
iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee));
|
||||||
|
|
||||||
var result = baseMap(collection, function(value, key, collection) {
|
var result = baseMap(collection, function(value, key, collection) {
|
||||||
var criteria = arrayMap(iteratees, function(iteratee) {
|
var criteria = arrayMap(iteratees, function(iteratee) {
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ define(['./_arrayReduce'], function(arrayReduce) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.pick` without support for individual
|
* The base implementation of `_.pick` without support for individual
|
||||||
* property names.
|
* property identifiers.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Object} object The source object.
|
* @param {Object} object The source object.
|
||||||
* @param {string[]} props The property names to pick.
|
* @param {string[]} props The property identifiers to pick.
|
||||||
* @returns {Object} Returns the new object.
|
* @returns {Object} Returns the new object.
|
||||||
*/
|
*/
|
||||||
function basePick(object, props) {
|
function basePick(object, props) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_baseForIn'], function(baseForIn) {
|
define(['./_getAllKeysIn'], function(getAllKeysIn) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.pickBy` without support for iteratee shorthands.
|
* The base implementation of `_.pickBy` without support for iteratee shorthands.
|
||||||
@@ -9,12 +9,19 @@ define(['./_baseForIn'], function(baseForIn) {
|
|||||||
* @returns {Object} Returns the new object.
|
* @returns {Object} Returns the new object.
|
||||||
*/
|
*/
|
||||||
function basePickBy(object, predicate) {
|
function basePickBy(object, predicate) {
|
||||||
var result = {};
|
var index = -1,
|
||||||
baseForIn(object, function(value, key) {
|
props = getAllKeysIn(object),
|
||||||
|
length = props.length,
|
||||||
|
result = {};
|
||||||
|
|
||||||
|
while (++index < length) {
|
||||||
|
var key = props[index],
|
||||||
|
value = object[key];
|
||||||
|
|
||||||
if (predicate(value, key)) {
|
if (predicate(value, key)) {
|
||||||
result[key] = value;
|
result[key] = value;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_baseCastPath', './_isIndex', './_isKey', './last', './_parent'], function(baseCastPath, isIndex, isKey, last, parent) {
|
define(['./_castPath', './_isIndex', './_isKey', './last', './_parent', './_toKey'], function(castPath, isIndex, isKey, last, parent, toKey) {
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
/** Used for built-in method references. */
|
||||||
var arrayProto = Array.prototype;
|
var arrayProto = Array.prototype;
|
||||||
@@ -21,21 +21,21 @@ define(['./_baseCastPath', './_isIndex', './_isKey', './last', './_parent'], fun
|
|||||||
|
|
||||||
while (length--) {
|
while (length--) {
|
||||||
var index = indexes[length];
|
var index = indexes[length];
|
||||||
if (lastIndex == length || index != previous) {
|
if (length == lastIndex || index !== previous) {
|
||||||
var previous = index;
|
var previous = index;
|
||||||
if (isIndex(index)) {
|
if (isIndex(index)) {
|
||||||
splice.call(array, index, 1);
|
splice.call(array, index, 1);
|
||||||
}
|
}
|
||||||
else if (!isKey(index, array)) {
|
else if (!isKey(index, array)) {
|
||||||
var path = baseCastPath(index),
|
var path = castPath(index),
|
||||||
object = parent(array, path);
|
object = parent(array, path);
|
||||||
|
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
delete object[last(path)];
|
delete object[toKey(last(path))];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
delete array[index];
|
delete array[toKey(index)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ define([], function() {
|
|||||||
* @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} initAccum 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.
|
||||||
*/
|
*/
|
||||||
|
|||||||
38
_baseRepeat.js
Normal file
38
_baseRepeat.js
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
define([], function() {
|
||||||
|
|
||||||
|
/** Used as references for various `Number` constants. */
|
||||||
|
var MAX_SAFE_INTEGER = 9007199254740991;
|
||||||
|
|
||||||
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||||
|
var nativeFloor = Math.floor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base implementation of `_.repeat` which doesn't coerce arguments.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {string} string The string to repeat.
|
||||||
|
* @param {number} n The number of times to repeat the string.
|
||||||
|
* @returns {string} Returns the repeated string.
|
||||||
|
*/
|
||||||
|
function baseRepeat(string, n) {
|
||||||
|
var result = '';
|
||||||
|
if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
// Leverage the exponentiation by squaring algorithm for a faster repeat.
|
||||||
|
// See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
|
||||||
|
do {
|
||||||
|
if (n % 2) {
|
||||||
|
result += string;
|
||||||
|
}
|
||||||
|
n = nativeFloor(n / 2);
|
||||||
|
if (n) {
|
||||||
|
string += string;
|
||||||
|
}
|
||||||
|
} while (n);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseRepeat;
|
||||||
|
});
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_assignValue', './_baseCastPath', './_isIndex', './_isKey', './isObject'], function(assignValue, baseCastPath, isIndex, isKey, isObject) {
|
define(['./_assignValue', './_castPath', './_isIndex', './_isKey', './isObject', './_toKey'], function(assignValue, castPath, isIndex, isKey, isObject, toKey) {
|
||||||
|
|
||||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
var undefined;
|
var undefined;
|
||||||
@@ -14,7 +14,7 @@ define(['./_assignValue', './_baseCastPath', './_isIndex', './_isKey', './isObje
|
|||||||
* @returns {Object} Returns `object`.
|
* @returns {Object} Returns `object`.
|
||||||
*/
|
*/
|
||||||
function baseSet(object, path, value, customizer) {
|
function baseSet(object, path, value, customizer) {
|
||||||
path = isKey(path, object) ? [path + ''] : baseCastPath(path);
|
path = isKey(path, object) ? [path] : castPath(path);
|
||||||
|
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = path.length,
|
length = path.length,
|
||||||
@@ -22,7 +22,7 @@ define(['./_assignValue', './_baseCastPath', './_isIndex', './_isKey', './isObje
|
|||||||
nested = object;
|
nested = object;
|
||||||
|
|
||||||
while (nested != null && ++index < length) {
|
while (nested != null && ++index < length) {
|
||||||
var key = path[index];
|
var key = toKey(path[index]);
|
||||||
if (isObject(nested)) {
|
if (isObject(nested)) {
|
||||||
var newValue = value;
|
var newValue = value;
|
||||||
if (index != lastIndex) {
|
if (index != lastIndex) {
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ define(['./_baseEach'], function(baseEach) {
|
|||||||
* @private
|
* @private
|
||||||
* @param {Array|Object} collection The collection to iterate over.
|
* @param {Array|Object} collection The collection to iterate over.
|
||||||
* @param {Function} predicate The function invoked per iteration.
|
* @param {Function} predicate The function invoked per iteration.
|
||||||
* @returns {boolean} Returns `true` if any element passes the predicate check, else `false`.
|
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
||||||
|
* else `false`.
|
||||||
*/
|
*/
|
||||||
function baseSome(collection, predicate) {
|
function baseSome(collection, predicate) {
|
||||||
var result;
|
var result;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_baseSortedIndexBy', './identity'], function(baseSortedIndexBy, identity) {
|
define(['./_baseSortedIndexBy', './identity', './isSymbol'], function(baseSortedIndexBy, identity, isSymbol) {
|
||||||
|
|
||||||
/** 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,
|
||||||
@@ -25,7 +25,8 @@ define(['./_baseSortedIndexBy', './identity'], function(baseSortedIndexBy, ident
|
|||||||
var mid = (low + high) >>> 1,
|
var mid = (low + high) >>> 1,
|
||||||
computed = array[mid];
|
computed = array[mid];
|
||||||
|
|
||||||
if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) {
|
if (computed !== null && !isSymbol(computed) &&
|
||||||
|
(retHighest ? (computed <= value) : (computed < value))) {
|
||||||
low = mid + 1;
|
low = mid + 1;
|
||||||
} else {
|
} else {
|
||||||
high = mid;
|
high = mid;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define([], function() {
|
define(['./isSymbol'], function(isSymbol) {
|
||||||
|
|
||||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
var undefined;
|
var undefined;
|
||||||
@@ -21,7 +21,8 @@ define([], function() {
|
|||||||
* @param {*} value The value to evaluate.
|
* @param {*} value The value to evaluate.
|
||||||
* @param {Function} iteratee The iteratee invoked per element.
|
* @param {Function} iteratee The iteratee invoked per element.
|
||||||
* @param {boolean} [retHighest] Specify returning the highest qualified index.
|
* @param {boolean} [retHighest] Specify returning the highest qualified index.
|
||||||
* @returns {number} Returns the index at which `value` should be inserted into `array`.
|
* @returns {number} Returns the index at which `value` should be inserted
|
||||||
|
* into `array`.
|
||||||
*/
|
*/
|
||||||
function baseSortedIndexBy(array, value, iteratee, retHighest) {
|
function baseSortedIndexBy(array, value, iteratee, retHighest) {
|
||||||
value = iteratee(value);
|
value = iteratee(value);
|
||||||
@@ -30,21 +31,26 @@ define([], function() {
|
|||||||
high = array ? array.length : 0,
|
high = array ? array.length : 0,
|
||||||
valIsNaN = value !== value,
|
valIsNaN = value !== value,
|
||||||
valIsNull = value === null,
|
valIsNull = value === null,
|
||||||
valIsUndef = value === undefined;
|
valIsSymbol = isSymbol(value),
|
||||||
|
valIsUndefined = value === undefined;
|
||||||
|
|
||||||
while (low < high) {
|
while (low < high) {
|
||||||
var mid = nativeFloor((low + high) / 2),
|
var mid = nativeFloor((low + high) / 2),
|
||||||
computed = iteratee(array[mid]),
|
computed = iteratee(array[mid]),
|
||||||
isDef = computed !== undefined,
|
othIsDefined = computed !== undefined,
|
||||||
isReflexive = computed === computed;
|
othIsNull = computed === null,
|
||||||
|
othIsReflexive = computed === computed,
|
||||||
|
othIsSymbol = isSymbol(computed);
|
||||||
|
|
||||||
if (valIsNaN) {
|
if (valIsNaN) {
|
||||||
var setLow = isReflexive || retHighest;
|
var setLow = retHighest || othIsReflexive;
|
||||||
|
} else if (valIsUndefined) {
|
||||||
|
setLow = othIsReflexive && (retHighest || othIsDefined);
|
||||||
} else if (valIsNull) {
|
} else if (valIsNull) {
|
||||||
setLow = isReflexive && isDef && (retHighest || computed != null);
|
setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
|
||||||
} else if (valIsUndef) {
|
} else if (valIsSymbol) {
|
||||||
setLow = isReflexive && (retHighest || isDef);
|
setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
|
||||||
} else if (computed == null) {
|
} else if (othIsNull || othIsSymbol) {
|
||||||
setLow = false;
|
setLow = false;
|
||||||
} else {
|
} else {
|
||||||
setLow = retHighest ? (computed <= value) : (computed < value);
|
setLow = retHighest ? (computed <= value) : (computed < value);
|
||||||
|
|||||||
@@ -1,14 +1,30 @@
|
|||||||
define(['./_baseSortedUniqBy'], function(baseSortedUniqBy) {
|
define(['./eq'], function(eq) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.sortedUniq`.
|
* The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
|
||||||
|
* support for iteratee shorthands.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Array} array The array to inspect.
|
* @param {Array} array The array to inspect.
|
||||||
|
* @param {Function} [iteratee] The iteratee invoked per element.
|
||||||
* @returns {Array} Returns the new duplicate free array.
|
* @returns {Array} Returns the new duplicate free array.
|
||||||
*/
|
*/
|
||||||
function baseSortedUniq(array) {
|
function baseSortedUniq(array, iteratee) {
|
||||||
return baseSortedUniqBy(array);
|
var index = -1,
|
||||||
|
length = array.length,
|
||||||
|
resIndex = 0,
|
||||||
|
result = [];
|
||||||
|
|
||||||
|
while (++index < length) {
|
||||||
|
var value = array[index],
|
||||||
|
computed = iteratee ? iteratee(value) : value;
|
||||||
|
|
||||||
|
if (!index || !eq(computed, seen)) {
|
||||||
|
var seen = computed;
|
||||||
|
result[resIndex++] = value === 0 ? 0 : value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseSortedUniq;
|
return baseSortedUniq;
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
define(['./eq'], function(eq) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base implementation of `_.sortedUniqBy` without support for iteratee
|
|
||||||
* shorthands.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Array} array The array to inspect.
|
|
||||||
* @param {Function} [iteratee] The iteratee invoked per element.
|
|
||||||
* @returns {Array} Returns the new duplicate free array.
|
|
||||||
*/
|
|
||||||
function baseSortedUniqBy(array, iteratee) {
|
|
||||||
var index = 0,
|
|
||||||
length = array.length,
|
|
||||||
value = array[0],
|
|
||||||
computed = iteratee ? iteratee(value) : value,
|
|
||||||
seen = computed,
|
|
||||||
resIndex = 1,
|
|
||||||
result = [value];
|
|
||||||
|
|
||||||
while (++index < length) {
|
|
||||||
value = array[index],
|
|
||||||
computed = iteratee ? iteratee(value) : value;
|
|
||||||
|
|
||||||
if (!eq(computed, seen)) {
|
|
||||||
seen = computed;
|
|
||||||
result[resIndex++] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return baseSortedUniqBy;
|
|
||||||
});
|
|
||||||
@@ -4,7 +4,8 @@ define([], function() {
|
|||||||
var undefined;
|
var undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.sum` without support for iteratee shorthands.
|
* The base implementation of `_.sum` and `_.sumBy` without support for
|
||||||
|
* iteratee shorthands.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Array} array The array to iterate over.
|
* @param {Array} array The array to iterate over.
|
||||||
|
|||||||
25
_baseToNumber.js
Normal file
25
_baseToNumber.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
define(['./isSymbol'], function(isSymbol) {
|
||||||
|
|
||||||
|
/** Used as references for various `Number` constants. */
|
||||||
|
var NAN = 0 / 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base implementation of `_.toNumber` which doesn't ensure correct
|
||||||
|
* conversions of binary, hexadecimal, or octal string values.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {*} value The value to process.
|
||||||
|
* @returns {number} Returns the number.
|
||||||
|
*/
|
||||||
|
function baseToNumber(value) {
|
||||||
|
if (typeof value == 'number') {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
if (isSymbol(value)) {
|
||||||
|
return NAN;
|
||||||
|
}
|
||||||
|
return +value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseToNumber;
|
||||||
|
});
|
||||||
34
_baseToString.js
Normal file
34
_baseToString.js
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
define(['./_Symbol', './isSymbol'], function(Symbol, isSymbol) {
|
||||||
|
|
||||||
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
|
var undefined;
|
||||||
|
|
||||||
|
/** Used as references for various `Number` constants. */
|
||||||
|
var INFINITY = 1 / 0;
|
||||||
|
|
||||||
|
/** Used to convert symbols to primitives and strings. */
|
||||||
|
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
||||||
|
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base implementation of `_.toString` which doesn't convert nullish
|
||||||
|
* values to empty strings.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {*} value The value to process.
|
||||||
|
* @returns {string} Returns the string.
|
||||||
|
*/
|
||||||
|
function baseToString(value) {
|
||||||
|
// Exit early for strings to avoid a performance hit in some environments.
|
||||||
|
if (typeof value == 'string') {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
if (isSymbol(value)) {
|
||||||
|
return symbolToString ? symbolToString.call(value) : '';
|
||||||
|
}
|
||||||
|
var result = (value + '');
|
||||||
|
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseToString;
|
||||||
|
});
|
||||||
@@ -41,6 +41,7 @@ define(['./_SetCache', './_arrayIncludes', './_arrayIncludesWith', './_cacheHas'
|
|||||||
var value = array[index],
|
var value = array[index],
|
||||||
computed = iteratee ? iteratee(value) : value;
|
computed = iteratee ? iteratee(value) : value;
|
||||||
|
|
||||||
|
value = (comparator || value !== 0) ? value : 0;
|
||||||
if (isCommon && computed === computed) {
|
if (isCommon && computed === computed) {
|
||||||
var seenIndex = seen.length;
|
var seenIndex = seen.length;
|
||||||
while (seenIndex--) {
|
while (seenIndex--) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_baseCastPath', './has', './_isKey', './last', './_parent'], function(baseCastPath, has, isKey, last, parent) {
|
define(['./_baseHas', './_castPath', './_isKey', './last', './_parent', './_toKey'], function(baseHas, castPath, isKey, last, parent, toKey) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of `_.unset`.
|
* The base implementation of `_.unset`.
|
||||||
@@ -9,10 +9,11 @@ define(['./_baseCastPath', './has', './_isKey', './last', './_parent'], function
|
|||||||
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
|
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
|
||||||
*/
|
*/
|
||||||
function baseUnset(object, path) {
|
function baseUnset(object, path) {
|
||||||
path = isKey(path, object) ? [path + ''] : baseCastPath(path);
|
path = isKey(path, object) ? [path] : castPath(path);
|
||||||
object = parent(object, path);
|
object = parent(object, path);
|
||||||
var key = last(path);
|
|
||||||
return (object != null && has(object, key)) ? delete object[key] : true;
|
var key = toKey(last(path));
|
||||||
|
return !(object != null && baseHas(object, key)) || delete object[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseUnset;
|
return baseUnset;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ define([], function() {
|
|||||||
* This base implementation of `_.zipObject` which assigns values using `assignFunc`.
|
* This base implementation of `_.zipObject` which assigns values using `assignFunc`.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Array} props The property names.
|
* @param {Array} props The property identifiers.
|
||||||
* @param {Array} values The property values.
|
* @param {Array} values The property values.
|
||||||
* @param {Function} assignFunc The function to assign values.
|
* @param {Function} assignFunc The function to assign values.
|
||||||
* @returns {Object} Returns the new object.
|
* @returns {Object} Returns the new object.
|
||||||
@@ -19,7 +19,8 @@ define([], function() {
|
|||||||
result = {};
|
result = {};
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
assignFunc(result, props[index], index < valsLength ? values[index] : undefined);
|
var value = index < valsLength ? values[index] : undefined;
|
||||||
|
assignFunc(result, props[index], value);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ define(['./isArrayLikeObject'], function(isArrayLikeObject) {
|
|||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {*} value The value to inspect.
|
* @param {*} value The value to inspect.
|
||||||
* @returns {Array} Returns the array-like object.
|
* @returns {Array|Object} Returns the cast array-like object.
|
||||||
*/
|
*/
|
||||||
function baseCastArrayLikeObject(value) {
|
function castArrayLikeObject(value) {
|
||||||
return isArrayLikeObject(value) ? value : [];
|
return isArrayLikeObject(value) ? value : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseCastArrayLikeObject;
|
return castArrayLikeObject;
|
||||||
});
|
});
|
||||||
@@ -5,11 +5,11 @@ define(['./identity'], function(identity) {
|
|||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {*} value The value to inspect.
|
* @param {*} value The value to inspect.
|
||||||
* @returns {Array} Returns the array-like object.
|
* @returns {Function} Returns cast function.
|
||||||
*/
|
*/
|
||||||
function baseCastFunction(value) {
|
function castFunction(value) {
|
||||||
return typeof value == 'function' ? value : identity;
|
return typeof value == 'function' ? value : identity;
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseCastFunction;
|
return castFunction;
|
||||||
});
|
});
|
||||||
@@ -7,9 +7,9 @@ define(['./isArray', './_stringToPath'], function(isArray, stringToPath) {
|
|||||||
* @param {*} value The value to inspect.
|
* @param {*} value The value to inspect.
|
||||||
* @returns {Array} Returns the cast property path array.
|
* @returns {Array} Returns the cast property path array.
|
||||||
*/
|
*/
|
||||||
function baseCastPath(value) {
|
function castPath(value) {
|
||||||
return isArray(value) ? value : stringToPath(value);
|
return isArray(value) ? value : stringToPath(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseCastPath;
|
return castPath;
|
||||||
});
|
});
|
||||||
22
_castSlice.js
Normal file
22
_castSlice.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
define(['./_baseSlice'], function(baseSlice) {
|
||||||
|
|
||||||
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
|
var undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Casts `array` to a slice if it's needed.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Array} array The array to inspect.
|
||||||
|
* @param {number} start The start position.
|
||||||
|
* @param {number} [end=array.length] The end position.
|
||||||
|
* @returns {Array} Returns the cast slice.
|
||||||
|
*/
|
||||||
|
function castSlice(array, start, end) {
|
||||||
|
var length = array.length;
|
||||||
|
end = end === undefined ? length : end;
|
||||||
|
return (!start && end >= length) ? array : baseSlice(array, start, end);
|
||||||
|
}
|
||||||
|
|
||||||
|
return castSlice;
|
||||||
|
});
|
||||||
17
_cloneDataView.js
Normal file
17
_cloneDataView.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
define(['./_cloneArrayBuffer'], function(cloneArrayBuffer) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a clone of `dataView`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Object} dataView The data view to clone.
|
||||||
|
* @param {boolean} [isDeep] Specify a deep clone.
|
||||||
|
* @returns {Object} Returns the cloned data view.
|
||||||
|
*/
|
||||||
|
function cloneDataView(dataView, isDeep) {
|
||||||
|
var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
|
||||||
|
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cloneDataView;
|
||||||
|
});
|
||||||
@@ -5,10 +5,13 @@ define(['./_addMapEntry', './_arrayReduce', './_mapToArray'], function(addMapEnt
|
|||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Object} map The map to clone.
|
* @param {Object} map The map to clone.
|
||||||
|
* @param {Function} cloneFunc The function to clone values.
|
||||||
|
* @param {boolean} [isDeep] Specify a deep clone.
|
||||||
* @returns {Object} Returns the cloned map.
|
* @returns {Object} Returns the cloned map.
|
||||||
*/
|
*/
|
||||||
function cloneMap(map) {
|
function cloneMap(map, isDeep, cloneFunc) {
|
||||||
return arrayReduce(mapToArray(map), addMapEntry, new map.constructor);
|
var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);
|
||||||
|
return arrayReduce(array, addMapEntry, new map.constructor);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cloneMap;
|
return cloneMap;
|
||||||
|
|||||||
@@ -5,10 +5,13 @@ define(['./_addSetEntry', './_arrayReduce', './_setToArray'], function(addSetEnt
|
|||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Object} set The set to clone.
|
* @param {Object} set The set to clone.
|
||||||
|
* @param {Function} cloneFunc The function to clone values.
|
||||||
|
* @param {boolean} [isDeep] Specify a deep clone.
|
||||||
* @returns {Object} Returns the cloned set.
|
* @returns {Object} Returns the cloned set.
|
||||||
*/
|
*/
|
||||||
function cloneSet(set) {
|
function cloneSet(set, isDeep, cloneFunc) {
|
||||||
return arrayReduce(setToArray(set), addSetEntry, new set.constructor);
|
var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);
|
||||||
|
return arrayReduce(array, addSetEntry, new set.constructor);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cloneSet;
|
return cloneSet;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define([], function() {
|
define(['./isSymbol'], function(isSymbol) {
|
||||||
|
|
||||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
var undefined;
|
var undefined;
|
||||||
@@ -13,22 +13,28 @@ define([], function() {
|
|||||||
*/
|
*/
|
||||||
function compareAscending(value, other) {
|
function compareAscending(value, other) {
|
||||||
if (value !== other) {
|
if (value !== other) {
|
||||||
var valIsNull = value === null,
|
var valIsDefined = value !== undefined,
|
||||||
valIsUndef = value === undefined,
|
valIsNull = value === null,
|
||||||
valIsReflexive = value === value;
|
valIsReflexive = value === value,
|
||||||
|
valIsSymbol = isSymbol(value);
|
||||||
|
|
||||||
var othIsNull = other === null,
|
var othIsDefined = other !== undefined,
|
||||||
othIsUndef = other === undefined,
|
othIsNull = other === null,
|
||||||
othIsReflexive = other === other;
|
othIsReflexive = other === other,
|
||||||
|
othIsSymbol = isSymbol(other);
|
||||||
|
|
||||||
if ((value > other && !othIsNull) || !valIsReflexive ||
|
if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
|
||||||
(valIsNull && !othIsUndef && othIsReflexive) ||
|
(valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
|
||||||
(valIsUndef && othIsReflexive)) {
|
(valIsNull && othIsDefined && othIsReflexive) ||
|
||||||
|
(!valIsDefined && othIsReflexive) ||
|
||||||
|
!valIsReflexive) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if ((value < other && !valIsNull) || !othIsReflexive ||
|
if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
|
||||||
(othIsNull && !valIsUndef && valIsReflexive) ||
|
(othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
|
||||||
(othIsUndef && valIsReflexive)) {
|
(othIsNull && valIsDefined && valIsReflexive) ||
|
||||||
|
(!othIsDefined && valIsReflexive) ||
|
||||||
|
!othIsReflexive) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ define(['./_compareAscending'], function(compareAscending) {
|
|||||||
// for more details.
|
// for more details.
|
||||||
//
|
//
|
||||||
// This also ensures a stable sort in V8 and other engines.
|
// This also ensures a stable sort in V8 and other engines.
|
||||||
// See https://code.google.com/p/v8/issues/detail?id=90 for more details.
|
// See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
|
||||||
return object.index - other.index;
|
return object.index - other.index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,31 @@
|
|||||||
define(['./_copyObjectWith'], function(copyObjectWith) {
|
define(['./_assignValue'], function(assignValue) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies properties of `source` to `object`.
|
* Copies properties of `source` to `object`.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Object} source The object to copy properties from.
|
* @param {Object} source The object to copy properties from.
|
||||||
* @param {Array} props The property names to copy.
|
* @param {Array} props The property identifiers to copy.
|
||||||
* @param {Object} [object={}] The object to copy properties to.
|
* @param {Object} [object={}] The object to copy properties to.
|
||||||
|
* @param {Function} [customizer] The function to customize copied values.
|
||||||
* @returns {Object} Returns `object`.
|
* @returns {Object} Returns `object`.
|
||||||
*/
|
*/
|
||||||
function copyObject(source, props, object) {
|
function copyObject(source, props, object, customizer) {
|
||||||
return copyObjectWith(source, props, object);
|
object || (object = {});
|
||||||
|
|
||||||
|
var index = -1,
|
||||||
|
length = props.length;
|
||||||
|
|
||||||
|
while (++index < length) {
|
||||||
|
var key = props[index];
|
||||||
|
|
||||||
|
var newValue = customizer
|
||||||
|
? customizer(object[key], source[key], key, object, source)
|
||||||
|
: source[key];
|
||||||
|
|
||||||
|
assignValue(object, key, newValue);
|
||||||
|
}
|
||||||
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
return copyObject;
|
return copyObject;
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
define(['./_assignValue'], function(assignValue) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function is like `copyObject` except that it accepts a function to
|
|
||||||
* customize copied values.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {Object} source The object to copy properties from.
|
|
||||||
* @param {Array} props The property names to copy.
|
|
||||||
* @param {Object} [object={}] The object to copy properties to.
|
|
||||||
* @param {Function} [customizer] The function to customize copied values.
|
|
||||||
* @returns {Object} Returns `object`.
|
|
||||||
*/
|
|
||||||
function copyObjectWith(source, props, object, customizer) {
|
|
||||||
object || (object = {});
|
|
||||||
|
|
||||||
var index = -1,
|
|
||||||
length = props.length;
|
|
||||||
|
|
||||||
while (++index < length) {
|
|
||||||
var key = props[index];
|
|
||||||
|
|
||||||
var newValue = customizer
|
|
||||||
? customizer(object[key], source[key], key, object, source)
|
|
||||||
: source[key];
|
|
||||||
|
|
||||||
assignValue(object, key, newValue);
|
|
||||||
}
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
|
|
||||||
return copyObjectWith;
|
|
||||||
});
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
define([], function() {
|
define([], function() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a base function for methods like `_.forIn`.
|
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {boolean} [fromRight] Specify iterating from right to left.
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ define(['./_createCtorWrapper', './_root'], function(createCtorWrapper, root) {
|
|||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Function} func The function to wrap.
|
* @param {Function} func The function to wrap.
|
||||||
* @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details.
|
* @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
|
||||||
|
* for more details.
|
||||||
* @param {*} [thisArg] The `this` binding of `func`.
|
* @param {*} [thisArg] The `this` binding of `func`.
|
||||||
* @returns {Function} Returns the new wrapped function.
|
* @returns {Function} Returns the new wrapped function.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,20 +1,8 @@
|
|||||||
define(['./_stringToArray', './toString'], function(stringToArray, toString) {
|
define(['./_castSlice', './_reHasComplexSymbol', './_stringToArray', './toString'], function(castSlice, reHasComplexSymbol, stringToArray, toString) {
|
||||||
|
|
||||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
var undefined;
|
var undefined;
|
||||||
|
|
||||||
/** Used to compose unicode character classes. */
|
|
||||||
var rsAstralRange = '\\ud800-\\udfff',
|
|
||||||
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
|
||||||
rsComboSymbolsRange = '\\u20d0-\\u20f0',
|
|
||||||
rsVarRange = '\\ufe0e\\ufe0f';
|
|
||||||
|
|
||||||
/** Used to compose unicode capture groups. */
|
|
||||||
var rsZWJ = '\\u200d';
|
|
||||||
|
|
||||||
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
|
||||||
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function like `_.lowerFirst`.
|
* Creates a function like `_.lowerFirst`.
|
||||||
*
|
*
|
||||||
@@ -30,8 +18,13 @@ define(['./_stringToArray', './toString'], function(stringToArray, toString) {
|
|||||||
? stringToArray(string)
|
? stringToArray(string)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
var chr = strSymbols ? strSymbols[0] : string.charAt(0),
|
var chr = strSymbols
|
||||||
trailing = strSymbols ? strSymbols.slice(1).join('') : string.slice(1);
|
? strSymbols[0]
|
||||||
|
: string.charAt(0);
|
||||||
|
|
||||||
|
var trailing = strSymbols
|
||||||
|
? castSlice(strSymbols, 1).join('')
|
||||||
|
: string.slice(1);
|
||||||
|
|
||||||
return chr[methodName]() + trailing;
|
return chr[methodName]() + trailing;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
define(['./_arrayReduce', './deburr', './words'], function(arrayReduce, deburr, words) {
|
define(['./_arrayReduce', './deburr', './words'], function(arrayReduce, deburr, words) {
|
||||||
|
|
||||||
|
/** Used to compose unicode capture groups. */
|
||||||
|
var rsApos = "['\u2019]";
|
||||||
|
|
||||||
|
/** Used to match apostrophes. */
|
||||||
|
var reApos = RegExp(rsApos, 'g');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function like `_.camelCase`.
|
* Creates a function like `_.camelCase`.
|
||||||
*
|
*
|
||||||
@@ -9,7 +15,7 @@ define(['./_arrayReduce', './deburr', './words'], function(arrayReduce, deburr,
|
|||||||
*/
|
*/
|
||||||
function createCompounder(callback) {
|
function createCompounder(callback) {
|
||||||
return function(string) {
|
return function(string) {
|
||||||
return arrayReduce(words(deburr(string)), callback, '');
|
return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ define(['./_baseCreate', './isObject'], function(baseCreate, isObject) {
|
|||||||
*/
|
*/
|
||||||
function createCtorWrapper(Ctor) {
|
function createCtorWrapper(Ctor) {
|
||||||
return function() {
|
return function() {
|
||||||
// Use a `switch` statement to work with class constructors.
|
// Use a `switch` statement to work with class constructors. See
|
||||||
// See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
|
// http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
|
||||||
// for more details.
|
// for more details.
|
||||||
var args = arguments;
|
var args = arguments;
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ define(['./_apply', './_createCtorWrapper', './_createHybridWrapper', './_create
|
|||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Function} func The function to wrap.
|
* @param {Function} func The function to wrap.
|
||||||
* @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details.
|
* @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
|
||||||
|
* for more details.
|
||||||
* @param {number} arity The arity of `func`.
|
* @param {number} arity The arity of `func`.
|
||||||
* @returns {Function} Returns the new wrapped function.
|
* @returns {Function} Returns the new wrapped function.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -55,7 +55,9 @@ define(['./_LodashWrapper', './_baseFlatten', './_getData', './_getFuncName', '.
|
|||||||
) {
|
) {
|
||||||
wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
|
wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
|
||||||
} else {
|
} else {
|
||||||
wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func);
|
wrapper = (func.length == 1 && isLaziable(func))
|
||||||
|
? wrapper[funcName]()
|
||||||
|
: wrapper.thru(func);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return function() {
|
return function() {
|
||||||
|
|||||||
@@ -17,11 +17,14 @@ define(['./_composeArgs', './_composeArgsRight', './_countHolders', './_createCt
|
|||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Function|string} func The function or method name to wrap.
|
* @param {Function|string} func The function or method name to wrap.
|
||||||
* @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details.
|
* @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
|
||||||
|
* for more details.
|
||||||
* @param {*} [thisArg] The `this` binding of `func`.
|
* @param {*} [thisArg] The `this` binding of `func`.
|
||||||
* @param {Array} [partials] The arguments to prepend to those provided to the new function.
|
* @param {Array} [partials] The arguments to prepend to those provided to
|
||||||
|
* the new function.
|
||||||
* @param {Array} [holders] The `partials` placeholder indexes.
|
* @param {Array} [holders] The `partials` placeholder indexes.
|
||||||
* @param {Array} [partialsRight] The arguments to append to those provided to the new function.
|
* @param {Array} [partialsRight] The arguments to append to those provided
|
||||||
|
* to the new function.
|
||||||
* @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
|
* @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
|
||||||
* @param {Array} [argPos] The argument positions of the new function.
|
* @param {Array} [argPos] The argument positions of the new function.
|
||||||
* @param {number} [ary] The arity cap of `func`.
|
* @param {number} [ary] The arity cap of `func`.
|
||||||
|
|||||||
40
_createMathOperation.js
Normal file
40
_createMathOperation.js
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
define(['./_baseToNumber', './_baseToString'], function(baseToNumber, baseToString) {
|
||||||
|
|
||||||
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
|
var undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a function that performs a mathematical operation on two values.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Function} operator The function to perform the operation.
|
||||||
|
* @returns {Function} Returns the new mathematical operation function.
|
||||||
|
*/
|
||||||
|
function createMathOperation(operator) {
|
||||||
|
return function(value, other) {
|
||||||
|
var result;
|
||||||
|
if (value === undefined && other === undefined) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (value !== undefined) {
|
||||||
|
result = value;
|
||||||
|
}
|
||||||
|
if (other !== undefined) {
|
||||||
|
if (result === undefined) {
|
||||||
|
return other;
|
||||||
|
}
|
||||||
|
if (typeof value == 'string' || typeof other == 'string') {
|
||||||
|
value = baseToString(value);
|
||||||
|
other = baseToString(other);
|
||||||
|
} else {
|
||||||
|
value = baseToNumber(value);
|
||||||
|
other = baseToNumber(other);
|
||||||
|
}
|
||||||
|
result = operator(value, other);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return createMathOperation;
|
||||||
|
});
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_apply', './_arrayMap', './_baseFlatten', './_baseIteratee', './rest'], function(apply, arrayMap, baseFlatten, baseIteratee, rest) {
|
define(['./_apply', './_arrayMap', './_baseFlatten', './_baseIteratee', './_baseUnary', './isArray', './_isFlattenableIteratee', './rest'], function(apply, arrayMap, baseFlatten, baseIteratee, baseUnary, isArray, isFlattenableIteratee, rest) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function like `_.over`.
|
* Creates a function like `_.over`.
|
||||||
@@ -9,7 +9,10 @@ define(['./_apply', './_arrayMap', './_baseFlatten', './_baseIteratee', './rest'
|
|||||||
*/
|
*/
|
||||||
function createOver(arrayFunc) {
|
function createOver(arrayFunc) {
|
||||||
return rest(function(iteratees) {
|
return rest(function(iteratees) {
|
||||||
iteratees = arrayMap(baseFlatten(iteratees, 1), baseIteratee);
|
iteratees = (iteratees.length == 1 && isArray(iteratees[0]))
|
||||||
|
? arrayMap(iteratees[0], baseUnary(baseIteratee))
|
||||||
|
: arrayMap(baseFlatten(iteratees, 1, isFlattenableIteratee), baseUnary(baseIteratee));
|
||||||
|
|
||||||
return rest(function(args) {
|
return rest(function(args) {
|
||||||
var thisArg = this;
|
var thisArg = this;
|
||||||
return arrayFunc(iteratees, function(iteratee) {
|
return arrayFunc(iteratees, function(iteratee) {
|
||||||
|
|||||||
@@ -1,20 +1,8 @@
|
|||||||
define(['./repeat', './_stringSize', './_stringToArray', './toInteger'], function(repeat, stringSize, stringToArray, toInteger) {
|
define(['./_baseRepeat', './_baseToString', './_castSlice', './_reHasComplexSymbol', './_stringSize', './_stringToArray'], function(baseRepeat, baseToString, castSlice, reHasComplexSymbol, stringSize, stringToArray) {
|
||||||
|
|
||||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
var undefined;
|
var undefined;
|
||||||
|
|
||||||
/** Used to compose unicode character classes. */
|
|
||||||
var rsAstralRange = '\\ud800-\\udfff',
|
|
||||||
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
|
|
||||||
rsComboSymbolsRange = '\\u20d0-\\u20f0',
|
|
||||||
rsVarRange = '\\ufe0e\\ufe0f';
|
|
||||||
|
|
||||||
/** Used to compose unicode capture groups. */
|
|
||||||
var rsZWJ = '\\u200d';
|
|
||||||
|
|
||||||
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
|
|
||||||
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
|
|
||||||
|
|
||||||
/* Built-in method references for those with the same name as other `lodash` methods. */
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||||
var nativeCeil = Math.ceil;
|
var nativeCeil = Math.ceil;
|
||||||
|
|
||||||
@@ -23,25 +11,21 @@ define(['./repeat', './_stringSize', './_stringToArray', './toInteger'], functio
|
|||||||
* is truncated if the number of characters exceeds `length`.
|
* is truncated if the number of characters exceeds `length`.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {string} string The string to create padding for.
|
* @param {number} length The padding length.
|
||||||
* @param {number} [length=0] The padding length.
|
|
||||||
* @param {string} [chars=' '] The string used as padding.
|
* @param {string} [chars=' '] The string used as padding.
|
||||||
* @returns {string} Returns the padding for `string`.
|
* @returns {string} Returns the padding for `string`.
|
||||||
*/
|
*/
|
||||||
function createPadding(string, length, chars) {
|
function createPadding(length, chars) {
|
||||||
length = toInteger(length);
|
chars = chars === undefined ? ' ' : baseToString(chars);
|
||||||
|
|
||||||
var strLength = stringSize(string);
|
var charsLength = chars.length;
|
||||||
if (!length || strLength >= length) {
|
if (charsLength < 2) {
|
||||||
return '';
|
return charsLength ? baseRepeat(chars, length) : chars;
|
||||||
}
|
}
|
||||||
var padLength = length - strLength;
|
var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
|
||||||
chars = chars === undefined ? ' ' : (chars + '');
|
|
||||||
|
|
||||||
var result = repeat(chars, nativeCeil(padLength / stringSize(chars)));
|
|
||||||
return reHasComplexSymbol.test(chars)
|
return reHasComplexSymbol.test(chars)
|
||||||
? stringToArray(result).slice(0, padLength).join('')
|
? castSlice(stringToArray(result), 0, length).join('')
|
||||||
: result.slice(0, padLength);
|
: result.slice(0, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
return createPadding;
|
return createPadding;
|
||||||
|
|||||||
@@ -4,15 +4,16 @@ define(['./_apply', './_createCtorWrapper', './_root'], function(apply, createCt
|
|||||||
var BIND_FLAG = 1;
|
var BIND_FLAG = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a function that wraps `func` to invoke it with the optional `this`
|
* Creates a function that wraps `func` to invoke it with the `this` binding
|
||||||
* binding of `thisArg` and the `partials` prepended to those provided to
|
* of `thisArg` and `partials` prepended to the arguments it receives.
|
||||||
* the wrapper.
|
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Function} func The function to wrap.
|
* @param {Function} func The function to wrap.
|
||||||
* @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details.
|
* @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
|
||||||
|
* for more details.
|
||||||
* @param {*} thisArg The `this` binding of `func`.
|
* @param {*} thisArg The `this` binding of `func`.
|
||||||
* @param {Array} partials The arguments to prepend to those provided to the new function.
|
* @param {Array} partials The arguments to prepend to those provided to
|
||||||
|
* the new function.
|
||||||
* @returns {Function} Returns the new wrapped function.
|
* @returns {Function} Returns the new wrapped function.
|
||||||
*/
|
*/
|
||||||
function createPartialWrapper(func, bitmask, thisArg, partials) {
|
function createPartialWrapper(func, bitmask, thisArg, partials) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_copyArray', './_isLaziable', './_setData'], function(copyArray, isLaziable, setData) {
|
define(['./_isLaziable', './_setData'], function(isLaziable, setData) {
|
||||||
|
|
||||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
var undefined;
|
var undefined;
|
||||||
@@ -16,11 +16,13 @@ define(['./_copyArray', './_isLaziable', './_setData'], function(copyArray, isLa
|
|||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Function} func The function to wrap.
|
* @param {Function} func The function to wrap.
|
||||||
* @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details.
|
* @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
|
||||||
|
* for more details.
|
||||||
* @param {Function} wrapFunc The function to create the `func` wrapper.
|
* @param {Function} wrapFunc The function to create the `func` wrapper.
|
||||||
* @param {*} placeholder The placeholder value.
|
* @param {*} placeholder The placeholder value.
|
||||||
* @param {*} [thisArg] The `this` binding of `func`.
|
* @param {*} [thisArg] The `this` binding of `func`.
|
||||||
* @param {Array} [partials] The arguments to prepend to those provided to the new function.
|
* @param {Array} [partials] The arguments to prepend to those provided to
|
||||||
|
* the new function.
|
||||||
* @param {Array} [holders] The `partials` placeholder indexes.
|
* @param {Array} [holders] The `partials` placeholder indexes.
|
||||||
* @param {Array} [argPos] The argument positions of the new function.
|
* @param {Array} [argPos] The argument positions of the new function.
|
||||||
* @param {number} [ary] The arity cap of `func`.
|
* @param {number} [ary] The arity cap of `func`.
|
||||||
@@ -29,7 +31,6 @@ define(['./_copyArray', './_isLaziable', './_setData'], function(copyArray, isLa
|
|||||||
*/
|
*/
|
||||||
function createRecurryWrapper(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
|
function createRecurryWrapper(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
|
||||||
var isCurry = bitmask & CURRY_FLAG,
|
var isCurry = bitmask & CURRY_FLAG,
|
||||||
newArgPos = argPos ? copyArray(argPos) : undefined,
|
|
||||||
newHolders = isCurry ? holders : undefined,
|
newHolders = isCurry ? holders : undefined,
|
||||||
newHoldersRight = isCurry ? undefined : holders,
|
newHoldersRight = isCurry ? undefined : holders,
|
||||||
newPartials = isCurry ? partials : undefined,
|
newPartials = isCurry ? partials : undefined,
|
||||||
@@ -43,7 +44,7 @@ define(['./_copyArray', './_isLaziable', './_setData'], function(copyArray, isLa
|
|||||||
}
|
}
|
||||||
var newData = [
|
var newData = [
|
||||||
func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
|
func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
|
||||||
newHoldersRight, newArgPos, ary, arity
|
newHoldersRight, argPos, ary, arity
|
||||||
];
|
];
|
||||||
|
|
||||||
var result = wrapFunc.apply(undefined, newData);
|
var result = wrapFunc.apply(undefined, newData);
|
||||||
|
|||||||
21
_createRelationalOperation.js
Normal file
21
_createRelationalOperation.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
define(['./toNumber'], function(toNumber) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a function that performs a relational operation on two values.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Function} operator The function to perform the operation.
|
||||||
|
* @returns {Function} Returns the new relational operation function.
|
||||||
|
*/
|
||||||
|
function createRelationalOperation(operator) {
|
||||||
|
return function(value, other) {
|
||||||
|
if (!(typeof value == 'string' && typeof other == 'string')) {
|
||||||
|
value = toNumber(value);
|
||||||
|
other = toNumber(other);
|
||||||
|
}
|
||||||
|
return operator(value, other);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return createRelationalOperation;
|
||||||
|
});
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
define(['./_Set', './noop'], function(Set, noop) {
|
define(['./_Set', './noop', './_setToArray'], function(Set, noop, setToArray) {
|
||||||
|
|
||||||
|
/** Used as references for various `Number` constants. */
|
||||||
|
var INFINITY = 1 / 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a set of `values`.
|
* Creates a set of `values`.
|
||||||
@@ -7,7 +10,7 @@ define(['./_Set', './noop'], function(Set, noop) {
|
|||||||
* @param {Array} values The values to add to the set.
|
* @param {Array} values The values to add to the set.
|
||||||
* @returns {Object} Returns the new set.
|
* @returns {Object} Returns the new set.
|
||||||
*/
|
*/
|
||||||
var createSet = !(Set && new Set([1, 2]).size === 2) ? noop : function(values) {
|
var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
|
||||||
return new Set(values);
|
return new Set(values);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ define(['./_arraySome'], function(arraySome) {
|
|||||||
* @param {Array} other The other array to compare.
|
* @param {Array} other The other array to compare.
|
||||||
* @param {Function} equalFunc The function to determine equivalents of values.
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
||||||
* @param {Function} customizer The function to customize comparisons.
|
* @param {Function} customizer The function to customize comparisons.
|
||||||
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` for more details.
|
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
|
||||||
|
* for more details.
|
||||||
* @param {Object} stack Tracks traversed `array` and `other` objects.
|
* @param {Object} stack Tracks traversed `array` and `other` objects.
|
||||||
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
||||||
*/
|
*/
|
||||||
@@ -58,12 +59,16 @@ define(['./_arraySome'], function(arraySome) {
|
|||||||
// Recursively compare arrays (susceptible to call stack limits).
|
// Recursively compare arrays (susceptible to call stack limits).
|
||||||
if (isUnordered) {
|
if (isUnordered) {
|
||||||
if (!arraySome(other, function(othValue) {
|
if (!arraySome(other, function(othValue) {
|
||||||
return arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack);
|
return arrValue === othValue ||
|
||||||
|
equalFunc(arrValue, othValue, customizer, bitmask, stack);
|
||||||
})) {
|
})) {
|
||||||
result = false;
|
result = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
|
} else if (!(
|
||||||
|
arrValue === othValue ||
|
||||||
|
equalFunc(arrValue, othValue, customizer, bitmask, stack)
|
||||||
|
)) {
|
||||||
result = false;
|
result = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ define(['./_Symbol', './_Uint8Array', './_equalArrays', './_mapToArray', './_set
|
|||||||
stringTag = '[object String]',
|
stringTag = '[object String]',
|
||||||
symbolTag = '[object Symbol]';
|
symbolTag = '[object Symbol]';
|
||||||
|
|
||||||
var arrayBufferTag = '[object ArrayBuffer]';
|
var arrayBufferTag = '[object ArrayBuffer]',
|
||||||
|
dataViewTag = '[object DataView]';
|
||||||
|
|
||||||
/** Used to convert symbols to primitives and strings. */
|
/** Used to convert symbols to primitives and strings. */
|
||||||
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
||||||
@@ -37,12 +38,21 @@ define(['./_Symbol', './_Uint8Array', './_equalArrays', './_mapToArray', './_set
|
|||||||
* @param {string} tag The `toStringTag` of the objects to compare.
|
* @param {string} tag The `toStringTag` of the objects to compare.
|
||||||
* @param {Function} equalFunc The function to determine equivalents of values.
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
||||||
* @param {Function} customizer The function to customize comparisons.
|
* @param {Function} customizer The function to customize comparisons.
|
||||||
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` for more details.
|
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
|
||||||
|
* for more details.
|
||||||
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
||||||
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
||||||
*/
|
*/
|
||||||
function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
|
function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
|
case dataViewTag:
|
||||||
|
if ((object.byteLength != other.byteLength) ||
|
||||||
|
(object.byteOffset != other.byteOffset)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
object = object.buffer;
|
||||||
|
other = other.buffer;
|
||||||
|
|
||||||
case arrayBufferTag:
|
case arrayBufferTag:
|
||||||
if ((object.byteLength != other.byteLength) ||
|
if ((object.byteLength != other.byteLength) ||
|
||||||
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
||||||
@@ -52,8 +62,9 @@ define(['./_Symbol', './_Uint8Array', './_equalArrays', './_mapToArray', './_set
|
|||||||
|
|
||||||
case boolTag:
|
case boolTag:
|
||||||
case dateTag:
|
case dateTag:
|
||||||
// Coerce dates and booleans to numbers, dates to milliseconds and booleans
|
// Coerce dates and booleans to numbers, dates to milliseconds and
|
||||||
// to `1` or `0` treating invalid dates coerced to `NaN` as not equal.
|
// booleans to `1` or `0` treating invalid dates coerced to `NaN` as
|
||||||
|
// not equal.
|
||||||
return +object == +other;
|
return +object == +other;
|
||||||
|
|
||||||
case errorTag:
|
case errorTag:
|
||||||
@@ -65,8 +76,9 @@ define(['./_Symbol', './_Uint8Array', './_equalArrays', './_mapToArray', './_set
|
|||||||
|
|
||||||
case regexpTag:
|
case regexpTag:
|
||||||
case stringTag:
|
case stringTag:
|
||||||
// Coerce regexes to strings and treat strings primitives and string
|
// Coerce regexes to strings and treat strings, primitives and objects,
|
||||||
// objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.
|
// as equal. See http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype.tostring
|
||||||
|
// for more details.
|
||||||
return object == (other + '');
|
return object == (other + '');
|
||||||
|
|
||||||
case mapTag:
|
case mapTag:
|
||||||
@@ -84,8 +96,11 @@ define(['./_Symbol', './_Uint8Array', './_equalArrays', './_mapToArray', './_set
|
|||||||
if (stacked) {
|
if (stacked) {
|
||||||
return stacked == other;
|
return stacked == other;
|
||||||
}
|
}
|
||||||
|
bitmask |= UNORDERED_COMPARE_FLAG;
|
||||||
|
stack.set(object, other);
|
||||||
|
|
||||||
// Recursively compare objects (susceptible to call stack limits).
|
// Recursively compare objects (susceptible to call stack limits).
|
||||||
return equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask | UNORDERED_COMPARE_FLAG, stack.set(object, other));
|
return equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
|
||||||
|
|
||||||
case symbolTag:
|
case symbolTag:
|
||||||
if (symbolValueOf) {
|
if (symbolValueOf) {
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ define(['./_baseHas', './keys'], function(baseHas, keys) {
|
|||||||
* @param {Object} other The other object to compare.
|
* @param {Object} other The other object to compare.
|
||||||
* @param {Function} equalFunc The function to determine equivalents of values.
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
||||||
* @param {Function} customizer The function to customize comparisons.
|
* @param {Function} customizer The function to customize comparisons.
|
||||||
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` for more details.
|
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
|
||||||
|
* for more details.
|
||||||
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
||||||
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
||||||
*/
|
*/
|
||||||
|
|||||||
15
_getAllKeys.js
Normal file
15
_getAllKeys.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
define(['./_baseGetAllKeys', './_getSymbols', './keys'], function(baseGetAllKeys, getSymbols, keys) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an array of own enumerable property names and symbols of `object`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Object} object The object to query.
|
||||||
|
* @returns {Array} Returns the array of property names and symbols.
|
||||||
|
*/
|
||||||
|
function getAllKeys(object) {
|
||||||
|
return baseGetAllKeys(object, keys, getSymbols);
|
||||||
|
}
|
||||||
|
|
||||||
|
return getAllKeys;
|
||||||
|
});
|
||||||
16
_getAllKeysIn.js
Normal file
16
_getAllKeysIn.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
define(['./_baseGetAllKeys', './_getSymbolsIn', './keysIn'], function(baseGetAllKeys, getSymbolsIn, keysIn) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an array of own and inherited enumerable property names and
|
||||||
|
* symbols of `object`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Object} object The object to query.
|
||||||
|
* @returns {Array} Returns the array of property names and symbols.
|
||||||
|
*/
|
||||||
|
function getAllKeysIn(object) {
|
||||||
|
return baseGetAllKeys(object, keysIn, getSymbolsIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
return getAllKeysIn;
|
||||||
|
});
|
||||||
@@ -3,8 +3,9 @@ define(['./_baseProperty'], function(baseProperty) {
|
|||||||
/**
|
/**
|
||||||
* Gets the "length" property value of `object`.
|
* Gets the "length" property value of `object`.
|
||||||
*
|
*
|
||||||
* **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
|
* **Note:** This function is used to avoid a
|
||||||
* that affects Safari on at least iOS 8.1-8.3 ARM64.
|
* [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects
|
||||||
|
* Safari on at least iOS 8.1-8.3 ARM64.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Object} object The object to query.
|
* @param {Object} object The object to query.
|
||||||
|
|||||||
18
_getPrototype.js
Normal file
18
_getPrototype.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
define([], function() {
|
||||||
|
|
||||||
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
||||||
|
var nativeGetPrototype = Object.getPrototypeOf;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the `[[Prototype]]` of `value`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {*} value The value to query.
|
||||||
|
* @returns {null|Object} Returns the `[[Prototype]]`.
|
||||||
|
*/
|
||||||
|
function getPrototype(value) {
|
||||||
|
return nativeGetPrototype(Object(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
return getPrototype;
|
||||||
|
});
|
||||||
@@ -4,15 +4,24 @@ define([], function() {
|
|||||||
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an array of the own symbol properties of `object`.
|
* Creates an array of the own enumerable symbol properties of `object`.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {Object} object The object to query.
|
* @param {Object} object The object to query.
|
||||||
* @returns {Array} Returns the array of symbols.
|
* @returns {Array} Returns the array of symbols.
|
||||||
*/
|
*/
|
||||||
var getSymbols = getOwnPropertySymbols || function() {
|
function getSymbols(object) {
|
||||||
return [];
|
// Coerce `object` to an object to avoid non-object errors in V8.
|
||||||
};
|
// See https://bugs.chromium.org/p/v8/issues/detail?id=3443 for more details.
|
||||||
|
return getOwnPropertySymbols(Object(object));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback for IE < 11.
|
||||||
|
if (!getOwnPropertySymbols) {
|
||||||
|
getSymbols = function() {
|
||||||
|
return [];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return getSymbols;
|
return getSymbols;
|
||||||
});
|
});
|
||||||
|
|||||||
24
_getSymbolsIn.js
Normal file
24
_getSymbolsIn.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
define(['./_arrayPush', './_getPrototype', './_getSymbols'], function(arrayPush, getPrototype, getSymbols) {
|
||||||
|
|
||||||
|
/** Built-in value references. */
|
||||||
|
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an array of the own and inherited enumerable symbol properties
|
||||||
|
* of `object`.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {Object} object The object to query.
|
||||||
|
* @returns {Array} Returns the array of symbols.
|
||||||
|
*/
|
||||||
|
var getSymbolsIn = !getOwnPropertySymbols ? getSymbols : function(object) {
|
||||||
|
var result = [];
|
||||||
|
while (object) {
|
||||||
|
arrayPush(result, getSymbols(object));
|
||||||
|
object = getPrototype(object);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
return getSymbolsIn;
|
||||||
|
});
|
||||||
35
_getTag.js
35
_getTag.js
@@ -1,27 +1,33 @@
|
|||||||
define(['./_Map', './_Set', './_WeakMap'], function(Map, Set, WeakMap) {
|
define(['./_DataView', './_Map', './_Promise', './_Set', './_WeakMap', './_toSource'], function(DataView, Map, Promise, Set, WeakMap, toSource) {
|
||||||
|
|
||||||
|
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||||
|
var undefined;
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var mapTag = '[object Map]',
|
var mapTag = '[object Map]',
|
||||||
objectTag = '[object Object]',
|
objectTag = '[object Object]',
|
||||||
|
promiseTag = '[object Promise]',
|
||||||
setTag = '[object Set]',
|
setTag = '[object Set]',
|
||||||
weakMapTag = '[object WeakMap]';
|
weakMapTag = '[object WeakMap]';
|
||||||
|
|
||||||
|
var dataViewTag = '[object DataView]';
|
||||||
|
|
||||||
/** Used for built-in method references. */
|
/** Used for built-in method references. */
|
||||||
var objectProto = Object.prototype;
|
var objectProto = Object.prototype;
|
||||||
|
|
||||||
/** Used to resolve the decompiled source of functions. */
|
|
||||||
var funcToString = Function.prototype.toString;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
* Used to resolve the
|
||||||
|
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
||||||
* of values.
|
* of values.
|
||||||
*/
|
*/
|
||||||
var objectToString = objectProto.toString;
|
var objectToString = objectProto.toString;
|
||||||
|
|
||||||
/** Used to detect maps, sets, and weakmaps. */
|
/** Used to detect maps, sets, and weakmaps. */
|
||||||
var mapCtorString = Map ? funcToString.call(Map) : '',
|
var dataViewCtorString = toSource(DataView),
|
||||||
setCtorString = Set ? funcToString.call(Set) : '',
|
mapCtorString = toSource(Map),
|
||||||
weakMapCtorString = WeakMap ? funcToString.call(WeakMap) : '';
|
promiseCtorString = toSource(Promise),
|
||||||
|
setCtorString = toSource(Set),
|
||||||
|
weakMapCtorString = toSource(WeakMap);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the `toStringTag` of `value`.
|
* Gets the `toStringTag` of `value`.
|
||||||
@@ -34,18 +40,23 @@ define(['./_Map', './_Set', './_WeakMap'], function(Map, Set, WeakMap) {
|
|||||||
return objectToString.call(value);
|
return objectToString.call(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback for IE 11 providing `toStringTag` values for maps, sets, and weakmaps.
|
// Fallback for data views, maps, sets, and weak maps in IE 11,
|
||||||
if ((Map && getTag(new Map) != mapTag) ||
|
// for data views in Edge, and promises in Node.js.
|
||||||
|
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
||||||
|
(Map && getTag(new Map) != mapTag) ||
|
||||||
|
(Promise && getTag(Promise.resolve()) != promiseTag) ||
|
||||||
(Set && getTag(new Set) != setTag) ||
|
(Set && getTag(new Set) != setTag) ||
|
||||||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
||||||
getTag = function(value) {
|
getTag = function(value) {
|
||||||
var result = objectToString.call(value),
|
var result = objectToString.call(value),
|
||||||
Ctor = result == objectTag ? value.constructor : null,
|
Ctor = result == objectTag ? value.constructor : undefined,
|
||||||
ctorString = typeof Ctor == 'function' ? funcToString.call(Ctor) : '';
|
ctorString = Ctor ? toSource(Ctor) : undefined;
|
||||||
|
|
||||||
if (ctorString) {
|
if (ctorString) {
|
||||||
switch (ctorString) {
|
switch (ctorString) {
|
||||||
|
case dataViewCtorString: return dataViewTag;
|
||||||
case mapCtorString: return mapTag;
|
case mapCtorString: return mapTag;
|
||||||
|
case promiseCtorString: return promiseTag;
|
||||||
case setCtorString: return setTag;
|
case setCtorString: return setTag;
|
||||||
case weakMapCtorString: return weakMapTag;
|
case weakMapCtorString: return weakMapTag;
|
||||||
}
|
}
|
||||||
|
|||||||
37
_hasPath.js
37
_hasPath.js
@@ -1,7 +1,4 @@
|
|||||||
define(['./_baseCastPath', './isArguments', './isArray', './_isIndex', './_isKey', './isLength', './isString', './last', './_parent'], function(baseCastPath, isArguments, isArray, isIndex, isKey, isLength, isString, last, parent) {
|
define(['./_castPath', './isArguments', './isArray', './_isIndex', './_isKey', './isLength', './isString', './_toKey'], function(castPath, isArguments, isArray, isIndex, isKey, isLength, isString, toKey) {
|
||||||
|
|
||||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
|
||||||
var undefined;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `path` exists on `object`.
|
* Checks if `path` exists on `object`.
|
||||||
@@ -13,23 +10,25 @@ define(['./_baseCastPath', './isArguments', './isArray', './_isIndex', './_isKey
|
|||||||
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
||||||
*/
|
*/
|
||||||
function hasPath(object, path, hasFunc) {
|
function hasPath(object, path, hasFunc) {
|
||||||
if (object == null) {
|
path = isKey(path, object) ? [path] : castPath(path);
|
||||||
return false;
|
|
||||||
}
|
var result,
|
||||||
var result = hasFunc(object, path);
|
index = -1,
|
||||||
if (!result && !isKey(path)) {
|
length = path.length;
|
||||||
path = baseCastPath(path);
|
|
||||||
object = parent(object, path);
|
while (++index < length) {
|
||||||
if (object != null) {
|
var key = toKey(path[index]);
|
||||||
path = last(path);
|
if (!(result = object != null && hasFunc(object, key))) {
|
||||||
result = hasFunc(object, path);
|
break;
|
||||||
}
|
}
|
||||||
|
object = object[key];
|
||||||
}
|
}
|
||||||
var length = object ? object.length : undefined;
|
if (result) {
|
||||||
return result || (
|
return result;
|
||||||
!!length && isLength(length) && isIndex(path, length) &&
|
}
|
||||||
(isArray(object) || isString(object) || isArguments(object))
|
var length = object ? object.length : 0;
|
||||||
);
|
return !!length && isLength(length) && isIndex(key, length) &&
|
||||||
|
(isArray(object) || isString(object) || isArguments(object));
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasPath;
|
return hasPath;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
define(['./_cloneArrayBuffer', './_cloneMap', './_cloneRegExp', './_cloneSet', './_cloneSymbol', './_cloneTypedArray'], function(cloneArrayBuffer, cloneMap, cloneRegExp, cloneSet, cloneSymbol, cloneTypedArray) {
|
define(['./_cloneArrayBuffer', './_cloneDataView', './_cloneMap', './_cloneRegExp', './_cloneSet', './_cloneSymbol', './_cloneTypedArray'], function(cloneArrayBuffer, cloneDataView, cloneMap, cloneRegExp, cloneSet, cloneSymbol, cloneTypedArray) {
|
||||||
|
|
||||||
/** `Object#toString` result references. */
|
/** `Object#toString` result references. */
|
||||||
var boolTag = '[object Boolean]',
|
var boolTag = '[object Boolean]',
|
||||||
@@ -11,6 +11,7 @@ define(['./_cloneArrayBuffer', './_cloneMap', './_cloneRegExp', './_cloneSet', '
|
|||||||
symbolTag = '[object Symbol]';
|
symbolTag = '[object Symbol]';
|
||||||
|
|
||||||
var arrayBufferTag = '[object ArrayBuffer]',
|
var arrayBufferTag = '[object ArrayBuffer]',
|
||||||
|
dataViewTag = '[object DataView]',
|
||||||
float32Tag = '[object Float32Array]',
|
float32Tag = '[object Float32Array]',
|
||||||
float64Tag = '[object Float64Array]',
|
float64Tag = '[object Float64Array]',
|
||||||
int8Tag = '[object Int8Array]',
|
int8Tag = '[object Int8Array]',
|
||||||
@@ -30,10 +31,11 @@ define(['./_cloneArrayBuffer', './_cloneMap', './_cloneRegExp', './_cloneSet', '
|
|||||||
* @private
|
* @private
|
||||||
* @param {Object} object The object to clone.
|
* @param {Object} object The object to clone.
|
||||||
* @param {string} tag The `toStringTag` of the object to clone.
|
* @param {string} tag The `toStringTag` of the object to clone.
|
||||||
|
* @param {Function} cloneFunc The function to clone values.
|
||||||
* @param {boolean} [isDeep] Specify a deep clone.
|
* @param {boolean} [isDeep] Specify a deep clone.
|
||||||
* @returns {Object} Returns the initialized clone.
|
* @returns {Object} Returns the initialized clone.
|
||||||
*/
|
*/
|
||||||
function initCloneByTag(object, tag, isDeep) {
|
function initCloneByTag(object, tag, cloneFunc, isDeep) {
|
||||||
var Ctor = object.constructor;
|
var Ctor = object.constructor;
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case arrayBufferTag:
|
case arrayBufferTag:
|
||||||
@@ -43,13 +45,16 @@ define(['./_cloneArrayBuffer', './_cloneMap', './_cloneRegExp', './_cloneSet', '
|
|||||||
case dateTag:
|
case dateTag:
|
||||||
return new Ctor(+object);
|
return new Ctor(+object);
|
||||||
|
|
||||||
|
case dataViewTag:
|
||||||
|
return cloneDataView(object, isDeep);
|
||||||
|
|
||||||
case float32Tag: case float64Tag:
|
case float32Tag: case float64Tag:
|
||||||
case int8Tag: case int16Tag: case int32Tag:
|
case int8Tag: case int16Tag: case int32Tag:
|
||||||
case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
|
case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
|
||||||
return cloneTypedArray(object, isDeep);
|
return cloneTypedArray(object, isDeep);
|
||||||
|
|
||||||
case mapTag:
|
case mapTag:
|
||||||
return cloneMap(object);
|
return cloneMap(object, isDeep, cloneFunc);
|
||||||
|
|
||||||
case numberTag:
|
case numberTag:
|
||||||
case stringTag:
|
case stringTag:
|
||||||
@@ -59,7 +64,7 @@ define(['./_cloneArrayBuffer', './_cloneMap', './_cloneRegExp', './_cloneSet', '
|
|||||||
return cloneRegExp(object);
|
return cloneRegExp(object);
|
||||||
|
|
||||||
case setTag:
|
case setTag:
|
||||||
return cloneSet(object);
|
return cloneSet(object, isDeep, cloneFunc);
|
||||||
|
|
||||||
case symbolTag:
|
case symbolTag:
|
||||||
return cloneSymbol(object);
|
return cloneSymbol(object);
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
define(['./_baseCreate', './_isPrototype'], function(baseCreate, isPrototype) {
|
define(['./_baseCreate', './_getPrototype', './_isPrototype'], function(baseCreate, getPrototype, isPrototype) {
|
||||||
|
|
||||||
/** Built-in value references. */
|
|
||||||
var getPrototypeOf = Object.getPrototypeOf;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes an object clone.
|
* Initializes an object clone.
|
||||||
@@ -12,7 +9,7 @@ define(['./_baseCreate', './_isPrototype'], function(baseCreate, isPrototype) {
|
|||||||
*/
|
*/
|
||||||
function initCloneObject(object) {
|
function initCloneObject(object) {
|
||||||
return (typeof object.constructor == 'function' && !isPrototype(object))
|
return (typeof object.constructor == 'function' && !isPrototype(object))
|
||||||
? baseCreate(getPrototypeOf(object))
|
? baseCreate(getPrototype(object))
|
||||||
: {};
|
: {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user