Add files
This commit is contained in:
commit
bb80829159
18195 changed files with 2122994 additions and 0 deletions
55
509bba0_unpacked_with_node_modules/~/shallowequal/modules/index.js
generated
Executable file
55
509bba0_unpacked_with_node_modules/~/shallowequal/modules/index.js
generated
Executable file
|
@ -0,0 +1,55 @@
|
|||
'use strict';
|
||||
|
||||
var fetchKeys = require('lodash.keys');
|
||||
|
||||
module.exports = function shallowEqual(objA, objB, compare, compareContext) {
|
||||
|
||||
var ret = compare ? compare.call(compareContext, objA, objB) : void 0;
|
||||
|
||||
if (ret !== void 0) {
|
||||
return !!ret;
|
||||
}
|
||||
|
||||
if (objA === objB) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var keysA = fetchKeys(objA);
|
||||
var keysB = fetchKeys(objB);
|
||||
|
||||
var len = keysA.length;
|
||||
if (len !== keysB.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
compareContext = compareContext || null;
|
||||
|
||||
// Test for A's keys different from B.
|
||||
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
|
||||
for (var i = 0; i < len; i++) {
|
||||
var key = keysA[i];
|
||||
if (!bHasOwnProperty(key)) {
|
||||
return false;
|
||||
}
|
||||
var valueA = objA[key];
|
||||
var valueB = objB[key];
|
||||
|
||||
var _ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
|
||||
if (_ret === false || _ret === void 0 && valueA !== valueB) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/shallowequal/modules/index.js
|
||||
// module id = 1210
|
||||
// module chunks = 4
|
Loading…
Add table
Add a link
Reference in a new issue