MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / _deepEqual

Function _deepEqual

lib/web/jshint.js:216–259  ·  view source on GitHub ↗
(actual, expected)

Source from the content-addressed store, hash-verified

214};
215
216function _deepEqual(actual, expected) {
217 // 7.1. All identical values are equivalent, as determined by ===.
218 if (actual === expected) {
219 return true;
220
221 } else if (util.isBuffer(actual) && util.isBuffer(expected)) {
222 if (actual.length != expected.length) return false;
223
224 for (var i = 0; i < actual.length; i++) {
225 if (actual[i] !== expected[i]) return false;
226 }
227
228 return true;
229
230 // 7.2. If the expected value is a Date object, the actual value is
231 // equivalent if it is also a Date object that refers to the same time.
232 } else if (util.isDate(actual) && util.isDate(expected)) {
233 return actual.getTime() === expected.getTime();
234
235 // 7.3 If the expected value is a RegExp object, the actual value is
236 // equivalent if it is also a RegExp object with the same source and
237 // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
238 } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
239 return actual.source === expected.source &&
240 actual.global === expected.global &&
241 actual.multiline === expected.multiline &&
242 actual.lastIndex === expected.lastIndex &&
243 actual.ignoreCase === expected.ignoreCase;
244
245 // 7.4. Other pairs that do not both pass typeof value == 'object',
246 // equivalence is determined by ==.
247 } else if (!util.isObject(actual) && !util.isObject(expected)) {
248 return actual == expected;
249
250 // 7.5 For all other Object pairs, including Array objects, equivalence is
251 // determined by having the same number of owned properties (as verified
252 // with Object.prototype.hasOwnProperty.call), the same set of keys
253 // (although not necessarily the same order), equivalent values for every
254 // corresponding key, and an identical 'prototype' property. Note: this
255 // accounts for both named and indexed properties on Arrays.
256 } else {
257 return objEquiv(actual, expected);
258 }
259}
260
261function isArguments(object) {
262 return Object.prototype.toString.call(object) == '[object Arguments]';

Callers 2

jshint.jsFile · 0.85
objEquivFunction · 0.85

Calls 2

objEquivFunction · 0.85
getTimeMethod · 0.45

Tested by

no test coverage detected