mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 15:57:48 +00:00
Tweak var names in _.clone and baseFlatten. [ci skip]
This commit is contained in:
36
dist/lodash.compat.js
vendored
36
dist/lodash.compat.js
vendored
@@ -1008,13 +1008,13 @@
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to clone.
|
||||
* @param {boolean} [deep=false] Specify a deep clone.
|
||||
* @param {boolean} [isDeep=false] Specify a deep clone.
|
||||
* @param {Function} [callback] The function to customize cloning values.
|
||||
* @param {Array} [stackA=[]] Tracks traversed source objects.
|
||||
* @param {Array} [stackB=[]] Associates clones with source counterparts.
|
||||
* @returns {*} Returns the cloned value.
|
||||
*/
|
||||
function baseClone(value, deep, callback, stackA, stackB) {
|
||||
function baseClone(value, isDeep, callback, stackA, stackB) {
|
||||
if (callback) {
|
||||
var result = callback(value);
|
||||
if (typeof result != 'undefined') {
|
||||
@@ -1047,7 +1047,7 @@
|
||||
return value;
|
||||
}
|
||||
var isArr = isArray(value);
|
||||
if (deep) {
|
||||
if (isDeep) {
|
||||
// check for circular references and return corresponding clone
|
||||
var initedStack = !stackA;
|
||||
stackA || (stackA = getArray());
|
||||
@@ -1074,7 +1074,7 @@
|
||||
}
|
||||
}
|
||||
// exit for shallow clone
|
||||
if (!deep) {
|
||||
if (!isDeep) {
|
||||
return result;
|
||||
}
|
||||
// add the source value to the stack of traversed objects
|
||||
@@ -1084,7 +1084,7 @@
|
||||
|
||||
// recursively populate clone (susceptible to call stack limits)
|
||||
(isArr ? baseEach : forOwn)(value, function(objValue, key) {
|
||||
result[key] = baseClone(objValue, deep, callback, stackA, stackB);
|
||||
result[key] = baseClone(objValue, isDeep, callback, stackA, stackB);
|
||||
});
|
||||
|
||||
if (initedStack) {
|
||||
@@ -1239,11 +1239,11 @@
|
||||
* @private
|
||||
* @param {Array} array The array to flatten.
|
||||
* @param {boolean} [isShallow=false] A flag to restrict flattening to a single level.
|
||||
* @param {boolean} [isArgArrays=false] A flag to restrict flattening to arrays and `arguments` objects.
|
||||
* @param {boolean} [isStrict=false] A flag to restrict flattening to arrays and `arguments` objects.
|
||||
* @param {number} [fromIndex=0] The index to start from.
|
||||
* @returns {Array} Returns a new flattened array.
|
||||
*/
|
||||
function baseFlatten(array, isShallow, isArgArrays, fromIndex) {
|
||||
function baseFlatten(array, isShallow, isStrict, fromIndex) {
|
||||
var index = (fromIndex || 0) - 1,
|
||||
length = array ? array.length : 0,
|
||||
result = [];
|
||||
@@ -1255,7 +1255,7 @@
|
||||
&& (isArray(value) || isArguments(value))) {
|
||||
// recursively flatten arrays (susceptible to call stack limits)
|
||||
if (!isShallow) {
|
||||
value = baseFlatten(value, isShallow, isArgArrays);
|
||||
value = baseFlatten(value, isShallow, isStrict);
|
||||
}
|
||||
var valIndex = -1,
|
||||
valLength = value.length,
|
||||
@@ -1265,7 +1265,7 @@
|
||||
while (++valIndex < valLength) {
|
||||
result[resIndex++] = value[valIndex];
|
||||
}
|
||||
} else if (!isArgArrays) {
|
||||
} else if (!isStrict) {
|
||||
result.push(value);
|
||||
}
|
||||
}
|
||||
@@ -2022,7 +2022,7 @@
|
||||
});
|
||||
|
||||
/**
|
||||
* Creates a clone of `value`. If `deep` is `true` nested objects will also
|
||||
* Creates a clone of `value`. If `isDeep` is `true` nested objects will also
|
||||
* be cloned, otherwise they will be assigned by reference. If a callback
|
||||
* is provided it will be executed to produce the cloned values. If the
|
||||
* callback returns `undefined` cloning will be handled by the method instead.
|
||||
@@ -2032,7 +2032,7 @@
|
||||
* @memberOf _
|
||||
* @category Objects
|
||||
* @param {*} value The value to clone.
|
||||
* @param {boolean} [deep=false] Specify a deep clone.
|
||||
* @param {boolean} [isDeep=false] Specify a deep clone.
|
||||
* @param {Function} [callback] The function to customize cloning values.
|
||||
* @param {*} [thisArg] The `this` binding of `callback`.
|
||||
* @returns {*} Returns the cloned value.
|
||||
@@ -2061,15 +2061,15 @@
|
||||
* clone.childNodes.length;
|
||||
* // => 0
|
||||
*/
|
||||
function clone(value, deep, callback, thisArg) {
|
||||
function clone(value, isDeep, callback, thisArg) {
|
||||
// allows working with "Collections" methods without using their `index`
|
||||
// and `collection` arguments for `deep` and `callback`
|
||||
if (typeof deep != 'boolean' && deep != null) {
|
||||
// and `collection` arguments for `isDeep` and `callback`
|
||||
if (typeof isDeep != 'boolean' && isDeep != null) {
|
||||
thisArg = callback;
|
||||
callback = deep;
|
||||
deep = false;
|
||||
callback = isDeep;
|
||||
isDeep = false;
|
||||
}
|
||||
return baseClone(value, deep, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1));
|
||||
return baseClone(value, isDeep, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3215,7 +3215,7 @@
|
||||
* _.contains({ 'name': 'fred', 'age': 40 }, 'fred');
|
||||
* // => true
|
||||
*
|
||||
* _.contains('pebbles', 'ur');
|
||||
* _.contains('pebbles', 'eb');
|
||||
* // => true
|
||||
*/
|
||||
function contains(collection, target, fromIndex) {
|
||||
|
||||
36
dist/lodash.js
vendored
36
dist/lodash.js
vendored
@@ -732,13 +732,13 @@
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to clone.
|
||||
* @param {boolean} [deep=false] Specify a deep clone.
|
||||
* @param {boolean} [isDeep=false] Specify a deep clone.
|
||||
* @param {Function} [callback] The function to customize cloning values.
|
||||
* @param {Array} [stackA=[]] Tracks traversed source objects.
|
||||
* @param {Array} [stackB=[]] Associates clones with source counterparts.
|
||||
* @returns {*} Returns the cloned value.
|
||||
*/
|
||||
function baseClone(value, deep, callback, stackA, stackB) {
|
||||
function baseClone(value, isDeep, callback, stackA, stackB) {
|
||||
if (callback) {
|
||||
var result = callback(value);
|
||||
if (typeof result != 'undefined') {
|
||||
@@ -771,7 +771,7 @@
|
||||
return value;
|
||||
}
|
||||
var isArr = isArray(value);
|
||||
if (deep) {
|
||||
if (isDeep) {
|
||||
// check for circular references and return corresponding clone
|
||||
var initedStack = !stackA;
|
||||
stackA || (stackA = getArray());
|
||||
@@ -798,7 +798,7 @@
|
||||
}
|
||||
}
|
||||
// exit for shallow clone
|
||||
if (!deep) {
|
||||
if (!isDeep) {
|
||||
return result;
|
||||
}
|
||||
// add the source value to the stack of traversed objects
|
||||
@@ -808,7 +808,7 @@
|
||||
|
||||
// recursively populate clone (susceptible to call stack limits)
|
||||
(isArr ? forEach : forOwn)(value, function(objValue, key) {
|
||||
result[key] = baseClone(objValue, deep, callback, stackA, stackB);
|
||||
result[key] = baseClone(objValue, isDeep, callback, stackA, stackB);
|
||||
});
|
||||
|
||||
if (initedStack) {
|
||||
@@ -963,11 +963,11 @@
|
||||
* @private
|
||||
* @param {Array} array The array to flatten.
|
||||
* @param {boolean} [isShallow=false] A flag to restrict flattening to a single level.
|
||||
* @param {boolean} [isArgArrays=false] A flag to restrict flattening to arrays and `arguments` objects.
|
||||
* @param {boolean} [isStrict=false] A flag to restrict flattening to arrays and `arguments` objects.
|
||||
* @param {number} [fromIndex=0] The index to start from.
|
||||
* @returns {Array} Returns a new flattened array.
|
||||
*/
|
||||
function baseFlatten(array, isShallow, isArgArrays, fromIndex) {
|
||||
function baseFlatten(array, isShallow, isStrict, fromIndex) {
|
||||
var index = (fromIndex || 0) - 1,
|
||||
length = array ? array.length : 0,
|
||||
result = [];
|
||||
@@ -979,7 +979,7 @@
|
||||
&& (isArray(value) || isArguments(value))) {
|
||||
// recursively flatten arrays (susceptible to call stack limits)
|
||||
if (!isShallow) {
|
||||
value = baseFlatten(value, isShallow, isArgArrays);
|
||||
value = baseFlatten(value, isShallow, isStrict);
|
||||
}
|
||||
var valIndex = -1,
|
||||
valLength = value.length,
|
||||
@@ -989,7 +989,7 @@
|
||||
while (++valIndex < valLength) {
|
||||
result[resIndex++] = value[valIndex];
|
||||
}
|
||||
} else if (!isArgArrays) {
|
||||
} else if (!isStrict) {
|
||||
result.push(value);
|
||||
}
|
||||
}
|
||||
@@ -1648,7 +1648,7 @@
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a clone of `value`. If `deep` is `true` nested objects will also
|
||||
* Creates a clone of `value`. If `isDeep` is `true` nested objects will also
|
||||
* be cloned, otherwise they will be assigned by reference. If a callback
|
||||
* is provided it will be executed to produce the cloned values. If the
|
||||
* callback returns `undefined` cloning will be handled by the method instead.
|
||||
@@ -1658,7 +1658,7 @@
|
||||
* @memberOf _
|
||||
* @category Objects
|
||||
* @param {*} value The value to clone.
|
||||
* @param {boolean} [deep=false] Specify a deep clone.
|
||||
* @param {boolean} [isDeep=false] Specify a deep clone.
|
||||
* @param {Function} [callback] The function to customize cloning values.
|
||||
* @param {*} [thisArg] The `this` binding of `callback`.
|
||||
* @returns {*} Returns the cloned value.
|
||||
@@ -1687,15 +1687,15 @@
|
||||
* clone.childNodes.length;
|
||||
* // => 0
|
||||
*/
|
||||
function clone(value, deep, callback, thisArg) {
|
||||
function clone(value, isDeep, callback, thisArg) {
|
||||
// allows working with "Collections" methods without using their `index`
|
||||
// and `collection` arguments for `deep` and `callback`
|
||||
if (typeof deep != 'boolean' && deep != null) {
|
||||
// and `collection` arguments for `isDeep` and `callback`
|
||||
if (typeof isDeep != 'boolean' && isDeep != null) {
|
||||
thisArg = callback;
|
||||
callback = deep;
|
||||
deep = false;
|
||||
callback = isDeep;
|
||||
isDeep = false;
|
||||
}
|
||||
return baseClone(value, deep, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1));
|
||||
return baseClone(value, isDeep, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2872,7 +2872,7 @@
|
||||
* _.contains({ 'name': 'fred', 'age': 40 }, 'fred');
|
||||
* // => true
|
||||
*
|
||||
* _.contains('pebbles', 'ur');
|
||||
* _.contains('pebbles', 'eb');
|
||||
* // => true
|
||||
*/
|
||||
function contains(collection, target, fromIndex) {
|
||||
|
||||
14
dist/lodash.underscore.js
vendored
14
dist/lodash.underscore.js
vendored
@@ -534,11 +534,11 @@
|
||||
* @private
|
||||
* @param {Array} array The array to flatten.
|
||||
* @param {boolean} [isShallow=false] A flag to restrict flattening to a single level.
|
||||
* @param {boolean} [isArgArrays=false] A flag to restrict flattening to arrays and `arguments` objects.
|
||||
* @param {boolean} [isStrict=false] A flag to restrict flattening to arrays and `arguments` objects.
|
||||
* @param {number} [fromIndex=0] The index to start from.
|
||||
* @returns {Array} Returns a new flattened array.
|
||||
*/
|
||||
function baseFlatten(array, isShallow, isArgArrays, fromIndex) {
|
||||
function baseFlatten(array, isShallow, isStrict, fromIndex) {
|
||||
var index = (fromIndex || 0) - 1,
|
||||
length = array ? array.length : 0,
|
||||
result = [];
|
||||
@@ -550,7 +550,7 @@
|
||||
&& (isArray(value) || isArguments(value))) {
|
||||
// recursively flatten arrays (susceptible to call stack limits)
|
||||
if (!isShallow) {
|
||||
value = baseFlatten(value, isShallow, isArgArrays);
|
||||
value = baseFlatten(value, isShallow, isStrict);
|
||||
}
|
||||
var valIndex = -1,
|
||||
valLength = value.length,
|
||||
@@ -560,7 +560,7 @@
|
||||
while (++valIndex < valLength) {
|
||||
result[resIndex++] = value[valIndex];
|
||||
}
|
||||
} else if (!isArgArrays) {
|
||||
} else if (!isStrict) {
|
||||
result.push(value);
|
||||
}
|
||||
}
|
||||
@@ -1005,7 +1005,7 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a clone of `value`. If `deep` is `true` nested objects will also
|
||||
* Creates a clone of `value`. If `isDeep` is `true` nested objects will also
|
||||
* be cloned, otherwise they will be assigned by reference. If a callback
|
||||
* is provided it will be executed to produce the cloned values. If the
|
||||
* callback returns `undefined` cloning will be handled by the method instead.
|
||||
@@ -1015,7 +1015,7 @@
|
||||
* @memberOf _
|
||||
* @category Objects
|
||||
* @param {*} value The value to clone.
|
||||
* @param {boolean} [deep=false] Specify a deep clone.
|
||||
* @param {boolean} [isDeep=false] Specify a deep clone.
|
||||
* @param {Function} [callback] The function to customize cloning values.
|
||||
* @param {*} [thisArg] The `this` binding of `callback`.
|
||||
* @returns {*} Returns the cloned value.
|
||||
@@ -1731,7 +1731,7 @@
|
||||
* _.contains({ 'name': 'fred', 'age': 40 }, 'fred');
|
||||
* // => true
|
||||
*
|
||||
* _.contains('pebbles', 'ur');
|
||||
* _.contains('pebbles', 'eb');
|
||||
* // => true
|
||||
*/
|
||||
function contains(collection, target) {
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
|
||||
## `Objects`
|
||||
* [`_.assign`](#_assignobject-source-callback-thisarg)
|
||||
* [`_.clone`](#_clonevalue-deepfalse-callback-thisarg)
|
||||
* [`_.clone`](#_clonevalue-isdeepfalse-callback-thisarg)
|
||||
* [`_.cloneDeep`](#_clonedeepvalue-callback-thisarg)
|
||||
* [`_.create`](#_createprototype-properties)
|
||||
* [`_.defaults`](#_defaultsobject-source)
|
||||
@@ -2762,14 +2762,14 @@ defaults(object, { 'name': 'fred', 'employer': 'slate' });
|
||||
|
||||
<!-- div -->
|
||||
|
||||
### <a id="_clonevalue-deepfalse-callback-thisarg"></a>`_.clone(value, [deep=false], [callback], [thisArg])`
|
||||
<a href="#_clonevalue-deepfalse-callback-thisarg">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2082 "View in source") [Ⓣ][1]
|
||||
### <a id="_clonevalue-isdeepfalse-callback-thisarg"></a>`_.clone(value, [isDeep=false], [callback], [thisArg])`
|
||||
<a href="#_clonevalue-isdeepfalse-callback-thisarg">#</a> [Ⓢ](https://github.com/lodash/lodash/blob/master/lodash.js#L2082 "View in source") [Ⓣ][1]
|
||||
|
||||
Creates a clone of `value`. If `deep` is `true` nested objects will also be cloned, otherwise they will be assigned by reference. If a callback is provided it will be executed to produce the cloned values. If the callback returns `undefined` cloning will be handled by the method instead. The callback is bound to `thisArg` and invoked with one argument; *(value)*.
|
||||
Creates a clone of `value`. If `isDeep` is `true` nested objects will also be cloned, otherwise they will be assigned by reference. If a callback is provided it will be executed to produce the cloned values. If the callback returns `undefined` cloning will be handled by the method instead. The callback is bound to `thisArg` and invoked with one argument; *(value)*.
|
||||
|
||||
#### Arguments
|
||||
1. `value` *(*)*: The value to clone.
|
||||
2. `[deep=false]` *(boolean)*: Specify a deep clone.
|
||||
2. `[isDeep=false]` *(boolean)*: Specify a deep clone.
|
||||
3. `[callback]` *(Function)*: The function to customize cloning values.
|
||||
4. `[thisArg]` *(*)*: The `this` binding of `callback`.
|
||||
|
||||
|
||||
34
lodash.js
34
lodash.js
@@ -1025,13 +1025,13 @@
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to clone.
|
||||
* @param {boolean} [deep=false] Specify a deep clone.
|
||||
* @param {boolean} [isDeep=false] Specify a deep clone.
|
||||
* @param {Function} [callback] The function to customize cloning values.
|
||||
* @param {Array} [stackA=[]] Tracks traversed source objects.
|
||||
* @param {Array} [stackB=[]] Associates clones with source counterparts.
|
||||
* @returns {*} Returns the cloned value.
|
||||
*/
|
||||
function baseClone(value, deep, callback, stackA, stackB) {
|
||||
function baseClone(value, isDeep, callback, stackA, stackB) {
|
||||
if (callback) {
|
||||
var result = callback(value);
|
||||
if (typeof result != 'undefined') {
|
||||
@@ -1064,7 +1064,7 @@
|
||||
return value;
|
||||
}
|
||||
var isArr = isArray(value);
|
||||
if (deep) {
|
||||
if (isDeep) {
|
||||
// check for circular references and return corresponding clone
|
||||
var initedStack = !stackA;
|
||||
stackA || (stackA = getArray());
|
||||
@@ -1091,7 +1091,7 @@
|
||||
}
|
||||
}
|
||||
// exit for shallow clone
|
||||
if (!deep) {
|
||||
if (!isDeep) {
|
||||
return result;
|
||||
}
|
||||
// add the source value to the stack of traversed objects
|
||||
@@ -1101,7 +1101,7 @@
|
||||
|
||||
// recursively populate clone (susceptible to call stack limits)
|
||||
(isArr ? baseEach : forOwn)(value, function(objValue, key) {
|
||||
result[key] = baseClone(objValue, deep, callback, stackA, stackB);
|
||||
result[key] = baseClone(objValue, isDeep, callback, stackA, stackB);
|
||||
});
|
||||
|
||||
if (initedStack) {
|
||||
@@ -1256,11 +1256,11 @@
|
||||
* @private
|
||||
* @param {Array} array The array to flatten.
|
||||
* @param {boolean} [isShallow=false] A flag to restrict flattening to a single level.
|
||||
* @param {boolean} [isArgArrays=false] A flag to restrict flattening to arrays and `arguments` objects.
|
||||
* @param {boolean} [isStrict=false] A flag to restrict flattening to arrays and `arguments` objects.
|
||||
* @param {number} [fromIndex=0] The index to start from.
|
||||
* @returns {Array} Returns a new flattened array.
|
||||
*/
|
||||
function baseFlatten(array, isShallow, isArgArrays, fromIndex) {
|
||||
function baseFlatten(array, isShallow, isStrict, fromIndex) {
|
||||
var index = (fromIndex || 0) - 1,
|
||||
length = array ? array.length : 0,
|
||||
result = [];
|
||||
@@ -1272,7 +1272,7 @@
|
||||
&& (isArray(value) || isArguments(value))) {
|
||||
// recursively flatten arrays (susceptible to call stack limits)
|
||||
if (!isShallow) {
|
||||
value = baseFlatten(value, isShallow, isArgArrays);
|
||||
value = baseFlatten(value, isShallow, isStrict);
|
||||
}
|
||||
var valIndex = -1,
|
||||
valLength = value.length,
|
||||
@@ -1282,7 +1282,7 @@
|
||||
while (++valIndex < valLength) {
|
||||
result[resIndex++] = value[valIndex];
|
||||
}
|
||||
} else if (!isArgArrays) {
|
||||
} else if (!isStrict) {
|
||||
result.push(value);
|
||||
}
|
||||
}
|
||||
@@ -2040,7 +2040,7 @@
|
||||
});
|
||||
|
||||
/**
|
||||
* Creates a clone of `value`. If `deep` is `true` nested objects will also
|
||||
* Creates a clone of `value`. If `isDeep` is `true` nested objects will also
|
||||
* be cloned, otherwise they will be assigned by reference. If a callback
|
||||
* is provided it will be executed to produce the cloned values. If the
|
||||
* callback returns `undefined` cloning will be handled by the method instead.
|
||||
@@ -2050,7 +2050,7 @@
|
||||
* @memberOf _
|
||||
* @category Objects
|
||||
* @param {*} value The value to clone.
|
||||
* @param {boolean} [deep=false] Specify a deep clone.
|
||||
* @param {boolean} [isDeep=false] Specify a deep clone.
|
||||
* @param {Function} [callback] The function to customize cloning values.
|
||||
* @param {*} [thisArg] The `this` binding of `callback`.
|
||||
* @returns {*} Returns the cloned value.
|
||||
@@ -2079,15 +2079,15 @@
|
||||
* clone.childNodes.length;
|
||||
* // => 0
|
||||
*/
|
||||
function clone(value, deep, callback, thisArg) {
|
||||
function clone(value, isDeep, callback, thisArg) {
|
||||
// allows working with "Collections" methods without using their `index`
|
||||
// and `collection` arguments for `deep` and `callback`
|
||||
if (typeof deep != 'boolean' && deep != null) {
|
||||
// and `collection` arguments for `isDeep` and `callback`
|
||||
if (typeof isDeep != 'boolean' && isDeep != null) {
|
||||
thisArg = callback;
|
||||
callback = deep;
|
||||
deep = false;
|
||||
callback = isDeep;
|
||||
isDeep = false;
|
||||
}
|
||||
return baseClone(value, deep, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1));
|
||||
return baseClone(value, isDeep, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user