Merge branch 'fix-eq-for-edge' of https://github.com/everedifice/jasmine into everedifice-fix-eq-for-edge
- Merges #1041
This commit is contained in:
@@ -2880,22 +2880,23 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Deep compare objects.
|
||||
for (var key in a) {
|
||||
if (has(a, key)) {
|
||||
// Count the expected number of properties.
|
||||
size++;
|
||||
// Deep compare each member.
|
||||
if (!(result = has(b, key) && eq(a[key], b[key], aStack, bStack, customTesters))) { break; }
|
||||
var aKeys = keys(a), key;
|
||||
size = aKeys.length;
|
||||
|
||||
// Ensure that both objects contain the same number of properties before comparing deep equality.
|
||||
if (keys(b).length !== size) { return false; }
|
||||
|
||||
while (size--) {
|
||||
key = aKeys[size];
|
||||
// Deep compare each member
|
||||
result = has(b, key) && eq(a[key], b[key], aStack, bStack, customTesters);
|
||||
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Ensure that both objects contain the same number of properties.
|
||||
if (result) {
|
||||
for (key in b) {
|
||||
if (has(b, key) && !(size--)) { break; }
|
||||
}
|
||||
result = !size;
|
||||
}
|
||||
}
|
||||
// Remove the first object from the stack of traversed objects.
|
||||
aStack.pop();
|
||||
@@ -2903,6 +2904,19 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
||||
|
||||
return result;
|
||||
|
||||
function keys(obj) {
|
||||
return Object.keys ? Object.keys(obj) :
|
||||
(function(o) {
|
||||
var keys = [];
|
||||
for (var key in o) {
|
||||
if (has(o, key)) {
|
||||
keys.push(key);
|
||||
}
|
||||
}
|
||||
return keys;
|
||||
})(obj);
|
||||
}
|
||||
|
||||
function has(obj, key) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, key);
|
||||
}
|
||||
|
||||
@@ -175,22 +175,23 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Deep compare objects.
|
||||
for (var key in a) {
|
||||
if (has(a, key)) {
|
||||
// Count the expected number of properties.
|
||||
size++;
|
||||
// Deep compare each member.
|
||||
if (!(result = has(b, key) && eq(a[key], b[key], aStack, bStack, customTesters))) { break; }
|
||||
var aKeys = keys(a), key;
|
||||
size = aKeys.length;
|
||||
|
||||
// Ensure that both objects contain the same number of properties before comparing deep equality.
|
||||
if (keys(b).length !== size) { return false; }
|
||||
|
||||
while (size--) {
|
||||
key = aKeys[size];
|
||||
// Deep compare each member
|
||||
result = has(b, key) && eq(a[key], b[key], aStack, bStack, customTesters);
|
||||
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Ensure that both objects contain the same number of properties.
|
||||
if (result) {
|
||||
for (key in b) {
|
||||
if (has(b, key) && !(size--)) { break; }
|
||||
}
|
||||
result = !size;
|
||||
}
|
||||
}
|
||||
// Remove the first object from the stack of traversed objects.
|
||||
aStack.pop();
|
||||
@@ -198,6 +199,19 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
||||
|
||||
return result;
|
||||
|
||||
function keys(obj) {
|
||||
return Object.keys ? Object.keys(obj) :
|
||||
(function(o) {
|
||||
var keys = [];
|
||||
for (var key in o) {
|
||||
if (has(o, key)) {
|
||||
keys.push(key);
|
||||
}
|
||||
}
|
||||
return keys;
|
||||
})(obj);
|
||||
}
|
||||
|
||||
function has(obj, key) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, key);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user