mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 21:52:19 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
36
web/node_modules/value-equal/esm/value-equal.js
generated
vendored
Normal file
36
web/node_modules/value-equal/esm/value-equal.js
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
function valueOf(obj) {
|
||||
return obj.valueOf ? obj.valueOf() : Object.prototype.valueOf.call(obj);
|
||||
}
|
||||
|
||||
function valueEqual(a, b) {
|
||||
// Test for strict equality first.
|
||||
if (a === b) return true;
|
||||
|
||||
// Otherwise, if either of them == null they are not equal.
|
||||
if (a == null || b == null) return false;
|
||||
|
||||
if (Array.isArray(a)) {
|
||||
return (
|
||||
Array.isArray(b) &&
|
||||
a.length === b.length &&
|
||||
a.every(function(item, index) {
|
||||
return valueEqual(item, b[index]);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof a === 'object' || typeof b === 'object') {
|
||||
var aValue = valueOf(a);
|
||||
var bValue = valueOf(b);
|
||||
|
||||
if (aValue !== a || bValue !== b) return valueEqual(aValue, bValue);
|
||||
|
||||
return Object.keys(Object.assign({}, a, b)).every(function(key) {
|
||||
return valueEqual(a[key], b[key]);
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export default valueEqual;
|
Loading…
Add table
Add a link
Reference in a new issue