Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
keithamus committed Nov 7, 2022
1 parent 775f509 commit 3c947a7
Showing 1 changed file with 38 additions and 7 deletions.
45 changes: 38 additions & 7 deletions chai.js
Original file line number Diff line number Diff line change
Expand Up @@ -9430,10 +9430,10 @@ function FakeMap() {
}

FakeMap.prototype = {
get: function getMap(key) {
get: function get(key) {
return key[this._key];
},
set: function setMap(key, value) {
set: function set(key, value) {
if (Object.isExtensible(key)) {
Object.defineProperty(key, this._key, {
value: value,
Expand Down Expand Up @@ -9625,8 +9625,9 @@ function extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandTyp
case 'function':
case 'WeakMap':
case 'WeakSet':
case 'Error':
return leftHandOperand === rightHandOperand;
case 'Error':
return keysEqual(leftHandOperand, rightHandOperand, [ 'name', 'message', 'code' ], options);
case 'Arguments':
case 'Int8Array':
case 'Uint8Array':
Expand All @@ -9651,6 +9652,19 @@ function extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandTyp
return entriesEqual(leftHandOperand, rightHandOperand, options);
case 'Map':
return entriesEqual(leftHandOperand, rightHandOperand, options);
case 'Temporal.PlainDate':
case 'Temporal.PlainTime':
case 'Temporal.PlainDateTime':
case 'Temporal.Instant':
case 'Temporal.ZonedDateTime':
case 'Temporal.PlainYearMonth':
case 'Temporal.PlainMonthDay':
return leftHandOperand.equals(rightHandOperand);
case 'Temporal.Duration':
return leftHandOperand.total('nanoseconds') === rightHandOperand.total('nanoseconds');
case 'Temporal.TimeZone':
case 'Temporal.Calendar':
return leftHandOperand.toString() === rightHandOperand.toString();
default:
return objectEqual(leftHandOperand, rightHandOperand, options);
}
Expand Down Expand Up @@ -9796,6 +9810,11 @@ function getEnumerableKeys(target) {
return keys;
}

function getNonEnumerableSymbols(target) {
var keys = Object.getOwnPropertySymbols(target);
return keys;
}

/*!
* Determines if two objects have matching values, given a set of keys. Defers to deepEqual for the equality check of
* each key. If any value of the given key is not equal, the function will return false (early).
Expand Down Expand Up @@ -9828,14 +9847,16 @@ function keysEqual(leftHandOperand, rightHandOperand, keys, options) {
* @param {Object} [options] (Optional)
* @return {Boolean} result
*/

function objectEqual(leftHandOperand, rightHandOperand, options) {
var leftHandKeys = getEnumerableKeys(leftHandOperand);
var rightHandKeys = getEnumerableKeys(rightHandOperand);
var leftHandSymbols = getNonEnumerableSymbols(leftHandOperand);
var rightHandSymbols = getNonEnumerableSymbols(rightHandOperand);
leftHandKeys = leftHandKeys.concat(leftHandSymbols);
rightHandKeys = rightHandKeys.concat(rightHandSymbols);

if (leftHandKeys.length && leftHandKeys.length === rightHandKeys.length) {
leftHandKeys.sort();
rightHandKeys.sort();
if (iterableEqual(leftHandKeys, rightHandKeys) === false) {
if (iterableEqual(mapSymbols(leftHandKeys).sort(), mapSymbols(rightHandKeys).sort()) === false) {
return false;
}
return keysEqual(leftHandOperand, rightHandOperand, leftHandKeys, options);
Expand Down Expand Up @@ -9872,6 +9893,16 @@ function isPrimitive(value) {
return value === null || typeof value !== 'object';
}

function mapSymbols(arr) {
return arr.map(function mapSymbol(entry) {
if (typeof entry === 'symbol') {
return entry.toString();
}

return entry;
});
}

},{"type-detect":39}],36:[function(require,module,exports){
'use strict';

Expand Down

0 comments on commit 3c947a7

Please sign in to comment.