mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-23 00:45:16 +00:00
1 line
11 KiB
JSON
1 line
11 KiB
JSON
|
{"ast":null,"code":"var objectKeys = require('object-keys');\n\nvar isArguments = require('is-arguments');\n\nvar is = require('object-is');\n\nvar isRegex = require('is-regex');\n\nvar flags = require('regexp.prototype.flags');\n\nvar isDate = require('is-date-object');\n\nvar getTime = Date.prototype.getTime;\n\nfunction deepEqual(actual, expected, options) {\n var opts = options || {}; // 7.1. All identical values are equivalent, as determined by ===.\n\n if (opts.strict ? is(actual, expected) : actual === expected) {\n return true;\n } // 7.3. Other pairs that do not both pass typeof value == 'object', equivalence is determined by ==.\n\n\n if (!actual || !expected || typeof actual !== 'object' && typeof expected !== 'object') {\n return opts.strict ? is(actual, expected) : actual == expected;\n }\n /*\n * 7.4. For all other Object pairs, including Array objects, equivalence is\n * determined by having the same number of owned properties (as verified\n * with Object.prototype.hasOwnProperty.call), the same set of keys\n * (although not necessarily the same order), equivalent values for every\n * corresponding key, and an identical 'prototype' property. Note: this\n * accounts for both named and indexed properties on Arrays.\n */\n // eslint-disable-next-line no-use-before-define\n\n\n return objEquiv(actual, expected, opts);\n}\n\nfunction isUndefinedOrNull(value) {\n return value === null || value === undefined;\n}\n\nfunction isBuffer(x) {\n if (!x || typeof x !== 'object' || typeof x.length !== 'number') {\n return false;\n }\n\n if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {\n return false;\n }\n\n if (x.length > 0 && typeof x[0] !== 'number') {\n return false;\n }\n\n return true;\n}\n\nfunction objEquiv(a, b, opts) {\n /* eslint max-statements: [2, 50] */\n var i, key;\n\n if (typeof a !== typeof b) {\n return false;\n }\n\n if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) {\n return false;\n } // an identical 'prototype' property.\n\n\n if (a.prototype !== b.prototype) {\n return false;\n }\n\n if (isArguments(a) !== isArguments(b)) {\n return false;\n }\n\n var aIsRegex = isRegex(a);\n var bIsRegex = isRegex(b);\n\n if (aIsRegex !== bIsRegex) {\n return false;\n }\n\n if (aIsRegex || bIsRegex) {\n return a.source === b.source && flags(a) === flags(b);\n }\n\n if (isDate(a) && isDate(b)) {\n return getTime.call(a) === getTime.call(b);\n }\n\n var aIsBuffer = isBuffer(a);\n var bIsBuffer = isBuffer(b);\n\n if (aIsBuffer !== bIsBuffer) {\n return false;\n }\n\n if (aIsBuffer || bIsBuffer) {\n // && would work too, because both are true or both false here\n if (a.length !== b.length) {\n return false;\n }\n\n for (i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n\n return true;\n }\n\n if (typeof a !== typeof b) {\n return false;\n }\n\n try {\n var ka = objectKeys(a);\n var kb = objectKeys(b);\n } catch (e) {\n // happens when one is a string literal and the other isn't\n return false;\n } // having the same number of owned properties (keys incorporates hasOwnProperty)\n\n\n if (ka.length !== kb.length) {\n return false;\n } // the same set of keys (although not necessarily the same order),\n\n\n ka.sort();\n kb.sort(); // ~~~cheap key test\n\n for (i = ka.length - 1; i >= 0; i--) {\n if (ka[i] != kb[i]) {\n return false;\n }\n } // equivalent values for every corresponding key, and ~~~possibly expensive deep test\n\n\n for (i = ka.length - 1; i >= 0; i--) {\n key = ka[i];\n\n if (!deepEqual(a[key], b[key], opts)) {\n return false;\n }\n }\n\n return true;\n}\n\nmodule.exports = deepEqual;","map":{"version":3,"sources":["/app/node_modules/deep-equal/index.js"],"names":["objectKeys","require","isArguments","is","isRegex","flags","isDate","getTime","Date","prototype","deepEqual","actual","expected","options","opts","strict","objEquiv","isUndefinedOrNull","value","undefined","is
|