MCPcopy Index your code
hub / github.com/prototypejs/prototype / isDeepEqual

Function isDeepEqual

test/unit/static/js/assertions.js:79–100  ·  view source on GitHub ↗
(actual, expected)

Source from the content-addressed store, hash-verified

77
78 // Utility for deep equality testing
79 function isDeepEqual (actual, expected) {
80 /* jshint eqeqeq: false */
81 if (actual === expected) {
82 return true;
83 }
84 if (expected instanceof Date && actual instanceof Date) {
85 return actual.getTime() === expected.getTime();
86 }
87 if (actual instanceof RegExp && expected instanceof RegExp) {
88 return (
89 actual.source === expected.source &&
90 actual.global === expected.global &&
91 actual.multiline === expected.multiline &&
92 actual.lastIndex === expected.lastIndex &&
93 actual.ignoreCase === expected.ignoreCase
94 );
95 }
96 if (typeof actual !== 'object' && typeof expected !== 'object') {
97 return actual == expected;
98 }
99 return objectsEqual(actual, expected);
100 }
101
102 // Utility for testing whether a function throws an error
103 function functionThrows (fn, expected) {

Callers 2

objectsEqualFunction · 0.70
assertions.jsFile · 0.70

Calls 1

objectsEqualFunction · 0.70

Tested by

no test coverage detected