Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lodash._baseclone

Package Overview
Dependencies
Maintainers
3
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash._baseclone - npm Package Compare versions

Comparing version 4.5.3 to 4.5.4

306

index.js
/**
* lodash 4.5.3 (Custom Build) <https://lodash.com/>
* lodash 4.5.4 (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/

@@ -30,2 +30,3 @@

objectTag = '[object Object]',
promiseTag = '[object Promise]',
regexpTag = '[object RegExp]',

@@ -38,2 +39,3 @@ setTag = '[object Set]',

var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',

@@ -55,3 +57,3 @@ float64Tag = '[object Float64Array]',

/** Used to detect host constructors (Safari > 5). */
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;

@@ -65,12 +67,12 @@

cloneableTags[argsTag] = cloneableTags[arrayTag] =
cloneableTags[arrayBufferTag] = cloneableTags[boolTag] =
cloneableTags[dateTag] = cloneableTags[float32Tag] =
cloneableTags[float64Tag] = cloneableTags[int8Tag] =
cloneableTags[int16Tag] = cloneableTags[int32Tag] =
cloneableTags[mapTag] = cloneableTags[numberTag] =
cloneableTags[objectTag] = cloneableTags[regexpTag] =
cloneableTags[setTag] = cloneableTags[stringTag] =
cloneableTags[symbolTag] = cloneableTags[uint8Tag] =
cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] =
cloneableTags[uint32Tag] = true;
cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
cloneableTags[boolTag] = cloneableTags[dateTag] =
cloneableTags[float32Tag] = cloneableTags[float64Tag] =
cloneableTags[int8Tag] = cloneableTags[int16Tag] =
cloneableTags[int32Tag] = cloneableTags[mapTag] =
cloneableTags[numberTag] = cloneableTags[objectTag] =
cloneableTags[regexpTag] = cloneableTags[setTag] =
cloneableTags[stringTag] = cloneableTags[symbolTag] =
cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
cloneableTags[errorTag] = cloneableTags[funcTag] =

@@ -171,2 +173,21 @@ cloneableTags[weakMapTag] = false;

/**
* Appends the elements of `values` to `array`.
*
* @private
* @param {Array} array The array to modify.
* @param {Array} values The values to append.
* @returns {Array} Returns `array`.
*/
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}
/**
* A specialized version of `_.reduce` for arrays without support for

@@ -179,3 +200,4 @@ * iteratee shorthands.

* @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.

@@ -319,3 +341,2 @@ */

Uint8Array = root.Uint8Array,
getPrototypeOf = Object.getPrototypeOf,
getOwnPropertySymbols = Object.getOwnPropertySymbols,

@@ -327,6 +348,9 @@ objectCreate = Object.create,

/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = Object.keys;
var nativeGetPrototype = Object.getPrototypeOf,
nativeKeys = Object.keys;
/* Built-in method references that are verified to be native. */
var Map = getNative(root, 'Map'),
var DataView = getNative(root, 'DataView'),
Map = getNative(root, 'Map'),
Promise = getNative(root, 'Promise'),
Set = getNative(root, 'Set'),

@@ -337,3 +361,5 @@ WeakMap = getNative(root, 'WeakMap'),

/** Used to detect maps, sets, and weakmaps. */
var mapCtorString = Map ? funcToString.call(Map) : '',
var dataViewCtorString = DataView ? (DataView + '') : '',
mapCtorString = Map ? funcToString.call(Map) : '',
promiseCtorString = Promise ? funcToString.call(Promise) : '',
setCtorString = Set ? funcToString.call(Set) : '',

@@ -407,2 +433,5 @@ weakMapCtorString = WeakMap ? funcToString.call(WeakMap) : '';

// Avoid inheriting from `Object.prototype` when possible.
Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto;
/**

@@ -500,3 +529,3 @@ * Creates a map cache object to store key-value pairs.

* @param {*} value The value to set.
* @returns {Object} Returns the map cache object.
* @returns {Object} Returns the map cache instance.
*/

@@ -515,2 +544,9 @@ function mapSet(key, value) {

// Add methods to `MapCache`.
MapCache.prototype.clear = mapClear;
MapCache.prototype['delete'] = mapDelete;
MapCache.prototype.get = mapGet;
MapCache.prototype.has = mapHas;
MapCache.prototype.set = mapSet;
/**

@@ -601,3 +637,3 @@ * Creates a stack cache object to store key-value pairs.

* @param {*} value The value to set.
* @returns {Object} Returns the stack cache object.
* @returns {Object} Returns the stack cache instance.
*/

@@ -623,2 +659,9 @@ function stackSet(key, value) {

// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
/**

@@ -628,3 +671,3 @@ * Removes `key` and its value from the associative array.

* @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.

@@ -673,4 +716,3 @@ * @returns {boolean} Returns `true` if the entry was removed, else `false`.

/**
* Gets the index at which the first occurrence of `key` is found in `array`
* of key-value pairs.
* Gets the index at which the `key` is found in `array` of key-value pairs.
*

@@ -784,4 +826,3 @@ * @private

if (!isDeep) {
result = baseAssign(result, value);
return isFull ? copySymbols(value, result) : result;
return copySymbols(value, baseAssign(result, value));
}

@@ -792,3 +833,3 @@ } else {

}
result = initCloneByTag(value, tag, isDeep);
result = initCloneByTag(value, tag, baseClone, isDeep);
}

@@ -804,7 +845,14 @@ }

if (!isArr) {
var props = isFull ? getAllKeys(value) : keys(value);
}
// Recursively populate clone (susceptible to call stack limits).
(isArr ? arrayEach : baseForOwn)(value, function(subValue, key) {
arrayEach(props || value, function(subValue, key) {
if (props) {
key = subValue;
subValue = value[key];
}
assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
});
return (isFull && !isArr) ? copySymbols(value, result) : result;
return result;
}

@@ -825,25 +873,17 @@

/**
* The base implementation of `baseForIn` and `baseForOwn` which iterates
* over `object` properties returned by `keysFunc` invoking `iteratee` for
* each property. Iteratee functions may exit iteration early by explicitly
* returning `false`.
* 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 iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {Object} object The object to query.
* @param {Function} keysFunc The function to get the keys of `object`.
* @returns {Object} Returns `object`.
* @param {Function} symbolsFunc The function to get the symbols of `object`.
* @returns {Array} Returns the array of property names and symbols.
*/
var baseFor = createBaseFor();
/**
* The base implementation of `_.forOwn` 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 baseForOwn(object, iteratee) {
return object && baseFor(object, iteratee, keys);
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result = keysFunc(object);
return isArray(object)
? result
: arrayPush(result, symbolsFunc(object));
}

@@ -864,3 +904,3 @@

return hasOwnProperty.call(object, key) ||
(typeof object == 'object' && key in object && getPrototypeOf(object) === null);
(typeof object == 'object' && key in object && getPrototype(object) === null);
}

@@ -924,2 +964,15 @@

/**
* 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);
}
/**
* Creates a clone of `map`.

@@ -929,6 +982,9 @@ *

* @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.
*/
function cloneMap(map) {
return arrayReduce(mapToArray(map), addMapEntry, new map.constructor);
function cloneMap(map, isDeep, cloneFunc) {
var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map);
return arrayReduce(array, addMapEntry, new map.constructor);
}

@@ -954,6 +1010,9 @@

* @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.
*/
function cloneSet(set) {
return arrayReduce(setToArray(set), addSetEntry, new set.constructor);
function cloneSet(set, isDeep, cloneFunc) {
var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set);
return arrayReduce(array, addSetEntry, new set.constructor);
}

@@ -1009,3 +1068,3 @@

* @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.

@@ -1024,3 +1083,3 @@ * @returns {Object} Returns `object`.

* @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.

@@ -1061,23 +1120,10 @@ * @param {Function} [customizer] The function to customize copied values.

/**
* Creates a base function for methods like `_.forIn`.
* Creates an array of own enumerable property names and symbols of `object`.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names and symbols.
*/
function createBaseFor(fromRight) {
return function(object, iteratee, keysFunc) {
var index = -1,
iterable = Object(object),
props = keysFunc(object),
length = props.length;
while (length--) {
var key = props[fromRight ? length : ++index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
return object;
};
function getAllKeys(object) {
return baseGetAllKeys(object, keys, getSymbols);
}

@@ -1088,4 +1134,5 @@

*
* **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
* that affects Safari on at least iOS 8.1-8.3 ARM64.
* **Note:** This function is used to avoid a
* [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects
* Safari on at least iOS 8.1-8.3 ARM64.
*

@@ -1112,12 +1159,32 @@ * @private

/**
* Creates an array of the own symbol properties of `object`.
* 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));
}
/**
* Creates an array of the own enumerable symbol properties of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
var getSymbols = getOwnPropertySymbols || function() {
return [];
};
function getSymbols(object) {
// 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 [];
};
}
/**

@@ -1134,4 +1201,7 @@ * Gets the `toStringTag` of `value`.

// Fallback for IE 11 providing `toStringTag` values for maps, sets, and weakmaps.
if ((Map && getTag(new Map) != mapTag) ||
// Fallback for data views, maps, sets, and weak maps in IE 11,
// 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) ||

@@ -1146,3 +1216,5 @@ (WeakMap && getTag(new WeakMap) != weakMapTag)) {

switch (ctorString) {
case dataViewCtorString: return dataViewTag;
case mapCtorString: return mapTag;
case promiseCtorString: return promiseTag;
case setCtorString: return setTag;

@@ -1184,3 +1256,3 @@ case weakMapCtorString: return weakMapTag;

return (typeof object.constructor == 'function' && !isPrototype(object))
? baseCreate(getPrototypeOf(object))
? baseCreate(getPrototype(object))
: {};

@@ -1198,6 +1270,7 @@ }

* @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.
* @returns {Object} Returns the initialized clone.
*/
function initCloneByTag(object, tag, isDeep) {
function initCloneByTag(object, tag, cloneFunc, isDeep) {
var Ctor = object.constructor;

@@ -1212,2 +1285,5 @@ switch (tag) {

case dataViewTag:
return cloneDataView(object, isDeep);
case float32Tag: case float64Tag:

@@ -1219,3 +1295,3 @@ case int8Tag: case int16Tag: case int32Tag:

case mapTag:
return cloneMap(object);
return cloneMap(object, isDeep, cloneFunc);

@@ -1230,3 +1306,3 @@ case numberTag:

case setTag:
return cloneSet(object);
return cloneSet(object, isDeep, cloneFunc);

@@ -1283,3 +1359,4 @@ case symbolTag:

/**
* Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.

@@ -1289,2 +1366,3 @@ *

* @memberOf _
* @since 4.0.0
* @category Lang

@@ -1323,5 +1401,7 @@ * @param {*} value The value to compare.

* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @returns {boolean} Returns `true` if `value` is correctly classified,
* else `false`.
* @example

@@ -1346,6 +1426,8 @@ *

* @memberOf _
* @since 0.1.0
* @type {Function}
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @returns {boolean} Returns `true` if `value` is correctly classified,
* else `false`.
* @example

@@ -1374,2 +1456,3 @@ *

* @memberOf _
* @since 4.0.0
* @category Lang

@@ -1402,5 +1485,7 @@ * @param {*} value The value to check.

* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.
* @returns {boolean} Returns `true` if `value` is an array-like object,
* else `false`.
* @example

@@ -1429,2 +1514,3 @@ *

* @memberOf _
* @since 4.3.0
* @category Lang

@@ -1450,5 +1536,7 @@ * @param {*} value The value to check.

* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @returns {boolean} Returns `true` if `value` is correctly classified,
* else `false`.
* @example

@@ -1473,9 +1561,12 @@ *

*
* **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
* **Note:** This function is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @returns {boolean} Returns `true` if `value` is a valid length,
* else `false`.
* @example

@@ -1506,2 +1597,3 @@ *

* @memberOf _
* @since 0.1.0
* @category Lang

@@ -1535,2 +1627,3 @@ * @param {*} value The value to check.

* @memberOf _
* @since 4.0.0
* @category Lang

@@ -1562,5 +1655,7 @@ * @param {*} value The value to check.

* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function, else `false`.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
* @example

@@ -1589,6 +1684,8 @@ *

* @static
* @since 0.1.0
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @returns {boolean} Returns `true` if `value` is correctly classified,
* else `false`.
* @example

@@ -1615,2 +1712,3 @@ *

* @static
* @since 0.1.0
* @memberOf _

@@ -1660,2 +1758,3 @@ * @category Object

* @memberOf _
* @since 2.4.0
* @category Util

@@ -1678,19 +1777,2 @@ * @param {*} value The value to return from the new function.

// Avoid inheriting from `Object.prototype` when possible.
Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto;
// Add functions to the `MapCache`.
MapCache.prototype.clear = mapClear;
MapCache.prototype['delete'] = mapDelete;
MapCache.prototype.get = mapGet;
MapCache.prototype.has = mapHas;
MapCache.prototype.set = mapSet;
// Add functions to the `Stack` cache.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
module.exports = baseClone;
{
"name": "lodash._baseclone",
"version": "4.5.3",
"version": "4.5.4",
"description": "The internal lodash function `baseClone` exported as a module.",

@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/",

@@ -1,2 +0,2 @@

# lodash._baseclone v4.5.3
# lodash._baseclone v4.5.4

@@ -18,2 +18,2 @@ The internal [lodash](https://lodash.com/) function `baseClone` exported as a [Node.js](https://nodejs.org/) module.

See the [package source](https://github.com/lodash/lodash/blob/4.5.3-npm-packages/lodash._baseclone) for more details.
See the [package source](https://github.com/lodash/lodash/blob/4.5.4-npm-packages/lodash._baseclone) for more details.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc