lodash.isequal
Advanced tools
Comparing version 4.1.2 to 4.1.3
138
index.js
/** | ||
* lodash 4.1.2 (Custom Build) <https://lodash.com/> | ||
* lodash 4.1.3 (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 | ||
*/ | ||
@@ -31,2 +31,3 @@ var Stack = require('lodash._stack'), | ||
objectTag = '[object Object]', | ||
promiseTag = '[object Promise]', | ||
regexpTag = '[object RegExp]', | ||
@@ -39,2 +40,3 @@ setTag = '[object Set]', | ||
var arrayBufferTag = '[object ArrayBuffer]', | ||
dataViewTag = '[object DataView]', | ||
float32Tag = '[object Float32Array]', | ||
@@ -53,3 +55,3 @@ float64Tag = '[object Float64Array]', | ||
/** Used to detect host constructors (Safari > 5). */ | ||
/** Used to detect host constructors (Safari). */ | ||
var reIsHostCtor = /^\[object .+?Constructor\]$/; | ||
@@ -66,7 +68,8 @@ | ||
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = | ||
typedArrayTags[dateTag] = typedArrayTags[errorTag] = | ||
typedArrayTags[funcTag] = typedArrayTags[mapTag] = | ||
typedArrayTags[numberTag] = typedArrayTags[objectTag] = | ||
typedArrayTags[regexpTag] = typedArrayTags[setTag] = | ||
typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; | ||
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = | ||
typedArrayTags[errorTag] = typedArrayTags[funcTag] = | ||
typedArrayTags[mapTag] = typedArrayTags[numberTag] = | ||
typedArrayTags[objectTag] = typedArrayTags[regexpTag] = | ||
typedArrayTags[setTag] = typedArrayTags[stringTag] = | ||
typedArrayTags[weakMapTag] = false; | ||
@@ -80,3 +83,4 @@ /** | ||
* @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`. | ||
*/ | ||
@@ -171,7 +175,11 @@ function arraySome(array, predicate) { | ||
var Symbol = root.Symbol, | ||
Uint8Array = root.Uint8Array, | ||
getPrototypeOf = Object.getPrototypeOf; | ||
Uint8Array = root.Uint8Array; | ||
/* Built-in method references for those with the same name as other `lodash` methods. */ | ||
var nativeGetPrototype = Object.getPrototypeOf; | ||
/* 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'), | ||
@@ -181,3 +189,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) : '', | ||
@@ -203,3 +213,3 @@ weakMapCtorString = WeakMap ? funcToString.call(WeakMap) : ''; | ||
return hasOwnProperty.call(object, key) || | ||
(typeof object == 'object' && key in object && getPrototypeOf(object) === null); | ||
(typeof object == 'object' && key in object && getPrototype(object) === null); | ||
} | ||
@@ -242,3 +252,4 @@ | ||
* @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. | ||
@@ -276,4 +287,7 @@ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. | ||
if (objIsWrapped || othIsWrapped) { | ||
var objUnwrapped = objIsWrapped ? object.value() : object, | ||
othUnwrapped = othIsWrapped ? other.value() : other; | ||
stack || (stack = new Stack); | ||
return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, bitmask, stack); | ||
return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack); | ||
} | ||
@@ -297,3 +311,4 @@ } | ||
* @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. | ||
@@ -340,3 +355,4 @@ * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. | ||
if (!arraySome(other, function(othValue) { | ||
return arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack); | ||
return arrValue === othValue || | ||
equalFunc(arrValue, othValue, customizer, bitmask, stack); | ||
})) { | ||
@@ -346,3 +362,6 @@ result = false; | ||
} | ||
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { | ||
} else if (!( | ||
arrValue === othValue || | ||
equalFunc(arrValue, othValue, customizer, bitmask, stack) | ||
)) { | ||
result = false; | ||
@@ -369,3 +388,4 @@ break; | ||
* @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. | ||
@@ -376,2 +396,10 @@ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. | ||
switch (tag) { | ||
case dataViewTag: | ||
if ((object.byteLength != other.byteLength) || | ||
(object.byteOffset != other.byteOffset)) { | ||
return false; | ||
} | ||
object = object.buffer; | ||
other = other.buffer; | ||
case arrayBufferTag: | ||
@@ -386,4 +414,5 @@ if ((object.byteLength != other.byteLength) || | ||
case dateTag: | ||
// Coerce dates and booleans to numbers, dates to milliseconds and booleans | ||
// to `1` or `0` treating invalid dates coerced to `NaN` as not equal. | ||
// Coerce dates and booleans to numbers, dates to milliseconds and | ||
// booleans to `1` or `0` treating invalid dates coerced to `NaN` as | ||
// not equal. | ||
return +object == +other; | ||
@@ -400,4 +429,4 @@ | ||
case stringTag: | ||
// Coerce regexes to strings and treat strings primitives and string | ||
// objects as equal. See https://es5.github.io/#x15.10.6.4 for more details. | ||
// Coerce regexes to strings and treat strings, primitives and objects, | ||
// as equal. See https://es5.github.io/#x15.10.6.4 for more details. | ||
return object == (other + ''); | ||
@@ -420,4 +449,7 @@ | ||
} | ||
bitmask |= UNORDERED_COMPARE_FLAG; | ||
stack.set(object, other); | ||
// 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); | ||
@@ -441,3 +473,4 @@ case symbolTag: | ||
* @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. | ||
@@ -522,2 +555,13 @@ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. | ||
/** | ||
* 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)); | ||
} | ||
/** | ||
* Gets the `toStringTag` of `value`. | ||
@@ -533,4 +577,7 @@ * | ||
// 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) || | ||
@@ -545,3 +592,5 @@ (WeakMap && getTag(new WeakMap) != weakMapTag)) { | ||
switch (ctorString) { | ||
case dataViewCtorString: return dataViewTag; | ||
case mapCtorString: return mapTag; | ||
case promiseCtorString: return promiseTag; | ||
case setCtorString: return setTag; | ||
@@ -560,6 +609,8 @@ case weakMapCtorString: return weakMapTag; | ||
* @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 | ||
@@ -593,6 +644,8 @@ * | ||
* @memberOf _ | ||
* @since 0.1.0 | ||
* @category Lang | ||
* @param {*} value The value to compare. | ||
* @param {*} other The other value to compare. | ||
* @returns {boolean} Returns `true` if the values are equivalent, else `false`. | ||
* @returns {boolean} Returns `true` if the values are equivalent, | ||
* else `false`. | ||
* @example | ||
@@ -618,5 +671,7 @@ * | ||
* @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 | ||
@@ -641,9 +696,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 | ||
@@ -674,2 +732,3 @@ * | ||
* @memberOf _ | ||
* @since 0.1.0 | ||
* @category Lang | ||
@@ -703,2 +762,3 @@ * @param {*} value The value to check. | ||
* @memberOf _ | ||
* @since 4.0.0 | ||
* @category Lang | ||
@@ -730,5 +790,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 | ||
@@ -758,5 +820,7 @@ * | ||
* @memberOf _ | ||
* @since 3.0.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 | ||
@@ -763,0 +827,0 @@ * |
{ | ||
"name": "lodash.isequal", | ||
"version": "4.1.2", | ||
"version": "4.1.3", | ||
"description": "The lodash method `_.isEqual` exported as a module.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/", |
@@ -1,2 +0,2 @@ | ||
# lodash.isequal v4.1.2 | ||
# lodash.isequal v4.1.3 | ||
@@ -18,2 +18,2 @@ The [lodash](https://lodash.com/) method `_.isEqual` exported as a [Node.js](https://nodejs.org/) module. | ||
See the [documentation](https://lodash.com/docs#isEqual) or [package source](https://github.com/lodash/lodash/blob/4.1.2-npm-packages/lodash.isequal) for more details. | ||
See the [documentation](https://lodash.com/docs#isEqual) or [package source](https://github.com/lodash/lodash/blob/4.1.3-npm-packages/lodash.isequal) for more details. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27650
744
1