fast-equals
Advanced tools
Comparing version 2.0.4 to 3.0.0
# fast-equals CHANGELOG | ||
## 3.0.0 | ||
### Breaking changes | ||
When creating a custom equality comparator via `createCustomEqual`, the equality method has an expanded contract: | ||
```ts | ||
// Before | ||
type EqualityComparator = (objectA: any, objectB: any, meta: any) => boolean; | ||
// After | ||
type InternalEqualityComparator = ( | ||
objectA: any, | ||
objectB: any, | ||
indexOrKeyA: any, | ||
indexOrKeyB: any, | ||
parentA: any, | ||
parentB: any, | ||
meta: any, | ||
) => boolean; | ||
``` | ||
If you have a custom equality comparator, you can ignore the differences by just passing additional `undefined` parameters, or you can use the parameters to further improve / clarify the logic. | ||
- Add [#57](https://github.com/planttheidea/fast-equals/pull/57) - support additional metadata for custom equality comparators | ||
## 2.0.4 | ||
@@ -25,3 +51,3 @@ | ||
#### Breaking changes | ||
### Breaking changes | ||
@@ -36,3 +62,3 @@ - There are longer `fast-equals/es`, `fast-equals/lib`, `fast-equals/mjs` locations | ||
#### Updates | ||
### Updates | ||
@@ -43,3 +69,3 @@ - Rewritten completely in TypeScript | ||
#### Fixes | ||
### Fixes | ||
@@ -144,1 +170,5 @@ - Consider pure objects (`Object.create(null)`) to be plain objects | ||
- Initial release | ||
``` | ||
``` |
@@ -83,3 +83,3 @@ 'use strict'; | ||
var _comparator = isEqual || comparator; | ||
return function circularEqual(a, b, cache) { | ||
return function circularEqual(a, b, indexOrKeyA, indexOrKeyB, parentA, parentB, cache) { | ||
if (cache === void 0) { cache = getNewCache(); } | ||
@@ -120,3 +120,3 @@ var isCacheableA = !!a && typeof a === 'object'; | ||
while (index-- > 0) { | ||
if (!isEqual(a[index], b[index], meta)) { | ||
if (!isEqual(a[index], b[index], index, index, a, b, meta)) { | ||
return false; | ||
@@ -140,16 +140,18 @@ } | ||
var matchedIndices_1 = {}; | ||
var indexA_1 = 0; | ||
a.forEach(function (aValue, aKey) { | ||
if (isValueEqual) { | ||
var hasMatch_1 = false; | ||
var matchIndex_1 = 0; | ||
var matchIndexB_1 = 0; | ||
b.forEach(function (bValue, bKey) { | ||
if (!hasMatch_1 && !matchedIndices_1[matchIndex_1]) { | ||
if (!hasMatch_1 && !matchedIndices_1[matchIndexB_1]) { | ||
hasMatch_1 = | ||
isEqual(aKey, bKey, meta) && isEqual(aValue, bValue, meta); | ||
isEqual(aKey, bKey, indexA_1, matchIndexB_1, a, b, meta) && isEqual(aValue, bValue, aKey, bKey, a, b, meta); | ||
if (hasMatch_1) { | ||
matchedIndices_1[matchIndex_1] = true; | ||
matchedIndices_1[matchIndexB_1] = true; | ||
} | ||
} | ||
matchIndex_1++; | ||
matchIndexB_1++; | ||
}); | ||
indexA_1++; | ||
isValueEqual = hasMatch_1; | ||
@@ -190,3 +192,3 @@ } | ||
} | ||
if (!hasOwnProperty(b, key) || !isEqual(a[key], b[key], meta)) { | ||
if (!hasOwnProperty(b, key) || !isEqual(a[key], b[key], key, key, a, b, meta)) { | ||
return false; | ||
@@ -227,14 +229,14 @@ } | ||
var matchedIndices_2 = {}; | ||
a.forEach(function (aValue) { | ||
a.forEach(function (aValue, aKey) { | ||
if (isValueEqual) { | ||
var hasMatch_2 = false; | ||
var matchIndex_2 = 0; | ||
b.forEach(function (bValue) { | ||
if (!hasMatch_2 && !matchedIndices_2[matchIndex_2]) { | ||
hasMatch_2 = isEqual(aValue, bValue, meta); | ||
var matchIndex_1 = 0; | ||
b.forEach(function (bValue, bKey) { | ||
if (!hasMatch_2 && !matchedIndices_2[matchIndex_1]) { | ||
hasMatch_2 = isEqual(aValue, bValue, aKey, bKey, a, b, meta); | ||
if (hasMatch_2) { | ||
matchedIndices_2[matchIndex_2] = true; | ||
matchedIndices_2[matchIndex_1] = true; | ||
} | ||
} | ||
matchIndex_2++; | ||
matchIndex_1++; | ||
}); | ||
@@ -255,3 +257,3 @@ isValueEqual = hasMatch_2; | ||
? createIsEqual(comparator) | ||
: comparator; | ||
: function (a, b, indexOrKeyA, indexOrKeyB, parentA, parentB, meta) { return comparator(a, b, meta); }; | ||
/* eslint-enable */ | ||
@@ -258,0 +260,0 @@ /** |
@@ -79,3 +79,3 @@ var HAS_WEAKSET_SUPPORT = typeof WeakSet === 'function'; | ||
var _comparator = isEqual || comparator; | ||
return function circularEqual(a, b, cache) { | ||
return function circularEqual(a, b, indexOrKeyA, indexOrKeyB, parentA, parentB, cache) { | ||
if (cache === void 0) { cache = getNewCache(); } | ||
@@ -116,3 +116,3 @@ var isCacheableA = !!a && typeof a === 'object'; | ||
while (index-- > 0) { | ||
if (!isEqual(a[index], b[index], meta)) { | ||
if (!isEqual(a[index], b[index], index, index, a, b, meta)) { | ||
return false; | ||
@@ -136,16 +136,18 @@ } | ||
var matchedIndices_1 = {}; | ||
var indexA_1 = 0; | ||
a.forEach(function (aValue, aKey) { | ||
if (isValueEqual) { | ||
var hasMatch_1 = false; | ||
var matchIndex_1 = 0; | ||
var matchIndexB_1 = 0; | ||
b.forEach(function (bValue, bKey) { | ||
if (!hasMatch_1 && !matchedIndices_1[matchIndex_1]) { | ||
if (!hasMatch_1 && !matchedIndices_1[matchIndexB_1]) { | ||
hasMatch_1 = | ||
isEqual(aKey, bKey, meta) && isEqual(aValue, bValue, meta); | ||
isEqual(aKey, bKey, indexA_1, matchIndexB_1, a, b, meta) && isEqual(aValue, bValue, aKey, bKey, a, b, meta); | ||
if (hasMatch_1) { | ||
matchedIndices_1[matchIndex_1] = true; | ||
matchedIndices_1[matchIndexB_1] = true; | ||
} | ||
} | ||
matchIndex_1++; | ||
matchIndexB_1++; | ||
}); | ||
indexA_1++; | ||
isValueEqual = hasMatch_1; | ||
@@ -186,3 +188,3 @@ } | ||
} | ||
if (!hasOwnProperty(b, key) || !isEqual(a[key], b[key], meta)) { | ||
if (!hasOwnProperty(b, key) || !isEqual(a[key], b[key], key, key, a, b, meta)) { | ||
return false; | ||
@@ -223,14 +225,14 @@ } | ||
var matchedIndices_2 = {}; | ||
a.forEach(function (aValue) { | ||
a.forEach(function (aValue, aKey) { | ||
if (isValueEqual) { | ||
var hasMatch_2 = false; | ||
var matchIndex_2 = 0; | ||
b.forEach(function (bValue) { | ||
if (!hasMatch_2 && !matchedIndices_2[matchIndex_2]) { | ||
hasMatch_2 = isEqual(aValue, bValue, meta); | ||
var matchIndex_1 = 0; | ||
b.forEach(function (bValue, bKey) { | ||
if (!hasMatch_2 && !matchedIndices_2[matchIndex_1]) { | ||
hasMatch_2 = isEqual(aValue, bValue, aKey, bKey, a, b, meta); | ||
if (hasMatch_2) { | ||
matchedIndices_2[matchIndex_2] = true; | ||
matchedIndices_2[matchIndex_1] = true; | ||
} | ||
} | ||
matchIndex_2++; | ||
matchIndex_1++; | ||
}); | ||
@@ -251,3 +253,3 @@ isValueEqual = hasMatch_2; | ||
? createIsEqual(comparator) | ||
: comparator; | ||
: function (a, b, indexOrKeyA, indexOrKeyB, parentA, parentB, meta) { return comparator(a, b, meta); }; | ||
/* eslint-enable */ | ||
@@ -254,0 +256,0 @@ /** |
@@ -85,3 +85,3 @@ (function (global, factory) { | ||
var _comparator = isEqual || comparator; | ||
return function circularEqual(a, b, cache) { | ||
return function circularEqual(a, b, indexOrKeyA, indexOrKeyB, parentA, parentB, cache) { | ||
if (cache === void 0) { cache = getNewCache(); } | ||
@@ -122,3 +122,3 @@ var isCacheableA = !!a && typeof a === 'object'; | ||
while (index-- > 0) { | ||
if (!isEqual(a[index], b[index], meta)) { | ||
if (!isEqual(a[index], b[index], index, index, a, b, meta)) { | ||
return false; | ||
@@ -142,16 +142,18 @@ } | ||
var matchedIndices_1 = {}; | ||
var indexA_1 = 0; | ||
a.forEach(function (aValue, aKey) { | ||
if (isValueEqual) { | ||
var hasMatch_1 = false; | ||
var matchIndex_1 = 0; | ||
var matchIndexB_1 = 0; | ||
b.forEach(function (bValue, bKey) { | ||
if (!hasMatch_1 && !matchedIndices_1[matchIndex_1]) { | ||
if (!hasMatch_1 && !matchedIndices_1[matchIndexB_1]) { | ||
hasMatch_1 = | ||
isEqual(aKey, bKey, meta) && isEqual(aValue, bValue, meta); | ||
isEqual(aKey, bKey, indexA_1, matchIndexB_1, a, b, meta) && isEqual(aValue, bValue, aKey, bKey, a, b, meta); | ||
if (hasMatch_1) { | ||
matchedIndices_1[matchIndex_1] = true; | ||
matchedIndices_1[matchIndexB_1] = true; | ||
} | ||
} | ||
matchIndex_1++; | ||
matchIndexB_1++; | ||
}); | ||
indexA_1++; | ||
isValueEqual = hasMatch_1; | ||
@@ -192,3 +194,3 @@ } | ||
} | ||
if (!hasOwnProperty(b, key) || !isEqual(a[key], b[key], meta)) { | ||
if (!hasOwnProperty(b, key) || !isEqual(a[key], b[key], key, key, a, b, meta)) { | ||
return false; | ||
@@ -229,14 +231,14 @@ } | ||
var matchedIndices_2 = {}; | ||
a.forEach(function (aValue) { | ||
a.forEach(function (aValue, aKey) { | ||
if (isValueEqual) { | ||
var hasMatch_2 = false; | ||
var matchIndex_2 = 0; | ||
b.forEach(function (bValue) { | ||
if (!hasMatch_2 && !matchedIndices_2[matchIndex_2]) { | ||
hasMatch_2 = isEqual(aValue, bValue, meta); | ||
var matchIndex_1 = 0; | ||
b.forEach(function (bValue, bKey) { | ||
if (!hasMatch_2 && !matchedIndices_2[matchIndex_1]) { | ||
hasMatch_2 = isEqual(aValue, bValue, aKey, bKey, a, b, meta); | ||
if (hasMatch_2) { | ||
matchedIndices_2[matchIndex_2] = true; | ||
matchedIndices_2[matchIndex_1] = true; | ||
} | ||
} | ||
matchIndex_2++; | ||
matchIndex_1++; | ||
}); | ||
@@ -257,3 +259,3 @@ isValueEqual = hasMatch_2; | ||
? createIsEqual(comparator) | ||
: comparator; | ||
: function (a, b, indexOrKeyA, indexOrKeyB, parentA, parentB, meta) { return comparator(a, b, meta); }; | ||
/* eslint-enable */ | ||
@@ -260,0 +262,0 @@ /** |
@@ -1,1 +0,1 @@ | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self)["fast-equals"]={})}(this,(function(n){"use strict";var e="function"==typeof WeakSet,t=Object.keys;function r(n,e){return n===e||n!=n&&e!=e}function o(n){return n.constructor===Object||null==n.constructor}function i(n){return!!n&&"function"==typeof n.then}function u(n){return!(!n||!n.$$typeof)}function f(){var n=[];return{add:function(e){n.push(e)},has:function(e){return-1!==n.indexOf(e)}}}var a=e?function(){return new WeakSet}:f;function c(n){return function(e){var t=n||e;return function(n,e,r){void 0===r&&(r=a());var o=!!n&&"object"==typeof n,i=!!e&&"object"==typeof e;if(o||i){var u=o&&r.has(n),f=i&&r.has(e);if(u||f)return u&&f;o&&r.add(n),i&&r.add(e)}return t(n,e,r)}}}var s=Function.prototype.bind.call(Function.prototype.call,Object.prototype.hasOwnProperty);function l(n,e,r,o){var i=t(n),f=i.length;if(t(e).length!==f)return!1;if(f)for(var a=void 0;f-- >0;){if("_owner"===(a=i[f])){var c=u(n),l=u(e);if((c||l)&&c!==l)return!1}if(!s(e,a)||!r(n[a],e[a],o))return!1}return!0}var p="function"==typeof Map,d="function"==typeof Set;function y(n){var e="function"==typeof n?n(t):t;function t(n,t,u){if(n===t)return!0;if(n&&t&&"object"==typeof n&&"object"==typeof t){if(o(n)&&o(t))return l(n,t,e,u);var f=Array.isArray(n),a=Array.isArray(t);return f||a?f===a&&function(n,e,t,r){var o=n.length;if(e.length!==o)return!1;for(;o-- >0;)if(!t(n[o],e[o],r))return!1;return!0}(n,t,e,u):(f=n instanceof Date,a=t instanceof Date,f||a?f===a&&r(n.getTime(),t.getTime()):(f=n instanceof RegExp,a=t instanceof RegExp,f||a?f===a&&function(n,e){return n.source===e.source&&n.global===e.global&&n.ignoreCase===e.ignoreCase&&n.multiline===e.multiline&&n.unicode===e.unicode&&n.sticky===e.sticky&&n.lastIndex===e.lastIndex}(n,t):i(n)||i(t)?n===t:p&&(f=n instanceof Map,a=t instanceof Map,f||a)?f===a&&function(n,e,t,r){var o=n.size===e.size;if(o&&n.size){var i={};n.forEach((function(n,u){if(o){var f=!1,a=0;e.forEach((function(e,o){f||i[a]||(f=t(u,o,r)&&t(n,e,r))&&(i[a]=!0),a++})),o=f}}))}return o}(n,t,e,u):d&&(f=n instanceof Set,a=t instanceof Set,f||a)?f===a&&function(n,e,t,r){var o=n.size===e.size;if(o&&n.size){var i={};n.forEach((function(n){if(o){var u=!1,f=0;e.forEach((function(e){u||i[f]||(u=t(n,e,r))&&(i[f]=!0),f++})),o=u}}))}return o}(n,t,e,u):l(n,t,e,u)))}return n!=n&&t!=t}return t}var v=y(),h=y((function(){return r})),b=y(c()),g=y(c(r));n.circularDeepEqual=b,n.circularShallowEqual=g,n.createCustomEqual=y,n.deepEqual=v,n.sameValueZeroEqual=r,n.shallowEqual=h,Object.defineProperty(n,"__esModule",{value:!0})})); | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self)["fast-equals"]={})}(this,(function(n){"use strict";var e="function"==typeof WeakSet,t=Object.keys;function r(n,e){return n===e||n!=n&&e!=e}function o(n){return n.constructor===Object||null==n.constructor}function i(n){return!!n&&"function"==typeof n.then}function u(n){return!(!n||!n.$$typeof)}function f(){var n=[];return{add:function(e){n.push(e)},has:function(e){return-1!==n.indexOf(e)}}}var a=e?function(){return new WeakSet}:f;function c(n){return function(e){var t=n||e;return function(n,e,r,o,i,u,f){void 0===f&&(f=a());var c=!!n&&"object"==typeof n,s=!!e&&"object"==typeof e;if(c||s){var l=c&&f.has(n),p=s&&f.has(e);if(l||p)return l&&p;c&&f.add(n),s&&f.add(e)}return t(n,e,f)}}}var s=Function.prototype.bind.call(Function.prototype.call,Object.prototype.hasOwnProperty);function l(n,e,r,o){var i=t(n),f=i.length;if(t(e).length!==f)return!1;if(f)for(var a=void 0;f-- >0;){if("_owner"===(a=i[f])){var c=u(n),l=u(e);if((c||l)&&c!==l)return!1}if(!s(e,a)||!r(n[a],e[a],a,a,n,e,o))return!1}return!0}var p="function"==typeof Map,d="function"==typeof Set;function y(n){var e="function"==typeof n?n(t):function(n,e,r,o,i,u,f){return t(n,e,f)};function t(n,t,u){if(n===t)return!0;if(n&&t&&"object"==typeof n&&"object"==typeof t){if(o(n)&&o(t))return l(n,t,e,u);var f=Array.isArray(n),a=Array.isArray(t);return f||a?f===a&&function(n,e,t,r){var o=n.length;if(e.length!==o)return!1;for(;o-- >0;)if(!t(n[o],e[o],o,o,n,e,r))return!1;return!0}(n,t,e,u):(f=n instanceof Date,a=t instanceof Date,f||a?f===a&&r(n.getTime(),t.getTime()):(f=n instanceof RegExp,a=t instanceof RegExp,f||a?f===a&&function(n,e){return n.source===e.source&&n.global===e.global&&n.ignoreCase===e.ignoreCase&&n.multiline===e.multiline&&n.unicode===e.unicode&&n.sticky===e.sticky&&n.lastIndex===e.lastIndex}(n,t):i(n)||i(t)?n===t:p&&(f=n instanceof Map,a=t instanceof Map,f||a)?f===a&&function(n,e,t,r){var o=n.size===e.size;if(o&&n.size){var i={},u=0;n.forEach((function(f,a){if(o){var c=!1,s=0;e.forEach((function(o,l){c||i[s]||(c=t(a,l,u,s,n,e,r)&&t(f,o,a,l,n,e,r))&&(i[s]=!0),s++})),u++,o=c}}))}return o}(n,t,e,u):d&&(f=n instanceof Set,a=t instanceof Set,f||a)?f===a&&function(n,e,t,r){var o=n.size===e.size;if(o&&n.size){var i={};n.forEach((function(u,f){if(o){var a=!1,c=0;e.forEach((function(o,s){a||i[c]||(a=t(u,o,f,s,n,e,r))&&(i[c]=!0),c++})),o=a}}))}return o}(n,t,e,u):l(n,t,e,u)))}return n!=n&&t!=t}return t}var v=y(),h=y((function(){return r})),b=y(c()),g=y(c(r));n.circularDeepEqual=b,n.circularShallowEqual=g,n.createCustomEqual=y,n.deepEqual=v,n.sameValueZeroEqual=r,n.shallowEqual=h,Object.defineProperty(n,"__esModule",{value:!0})})); |
@@ -6,5 +6,14 @@ declare type EqualityComparator = ( | ||
) => boolean; | ||
declare type InternalEqualityComparator = ( | ||
objectA: any, | ||
objectB: any, | ||
indexOrKeyA: any, | ||
indexOrKeyB: any, | ||
parentA: any, | ||
parentB: any, | ||
meta: any, | ||
) => boolean; | ||
declare type EqualityComparatorCreator = ( | ||
comparator: EqualityComparator, | ||
) => EqualityComparator; | ||
) => InternalEqualityComparator; | ||
@@ -11,0 +20,0 @@ export declare function createCustomEqual( |
@@ -9,20 +9,20 @@ { | ||
"devDependencies": { | ||
"@rollup/plugin-node-resolve": "^13.0.6", | ||
"@types/jest": "^27.0.3", | ||
"@types/lodash": "^4.14.177", | ||
"@types/node": "^16.11.11", | ||
"@types/ramda": "^0.27.59", | ||
"@types/react": "^17.0.37", | ||
"@typescript-eslint/eslint-plugin": "^5.5.0", | ||
"@typescript-eslint/parser": "^5.5.0", | ||
"@rollup/plugin-node-resolve": "^13.1.3", | ||
"@types/jest": "^27.4.0", | ||
"@types/lodash": "^4.14.178", | ||
"@types/node": "^17.0.17", | ||
"@types/ramda": "^0.27.64", | ||
"@types/react": "^17.0.39", | ||
"@typescript-eslint/eslint-plugin": "^5.11.0", | ||
"@typescript-eslint/parser": "^5.11.0", | ||
"benchee": "^1.1.0", | ||
"cli-table3": "^0.6.0", | ||
"cli-table3": "^0.6.1", | ||
"decircularize": "^1.0.0", | ||
"deep-eql": "^4.0.0", | ||
"deep-equal": "^2.0.5", | ||
"eslint": "^8.4.0", | ||
"eslint-config-airbnb": "^19.0.2", | ||
"eslint-plugin-import": "^2.25.3", | ||
"eslint": "^8.9.0", | ||
"eslint-config-airbnb": "^19.0.4", | ||
"eslint-plugin-import": "^2.25.4", | ||
"eslint-plugin-jsx-a11y": "^6.5.1", | ||
"eslint-plugin-react": "^7.27.1", | ||
"eslint-plugin-react": "^7.28.0", | ||
"eslint-webpack-plugin": "^3.1.1", | ||
@@ -33,3 +33,3 @@ "fast-deep-equal": "^3.1.3", | ||
"in-publish": "^2.0.0", | ||
"jest": "^27.4.3", | ||
"jest": "^27.5.1", | ||
"lodash": "^4.17.21", | ||
@@ -40,14 +40,14 @@ "nano-equal": "^2.0.2", | ||
"react-fast-compare": "^3.2.0", | ||
"release-it": "^14.11.8", | ||
"rollup": "^2.60.2", | ||
"release-it": "^14.12.4", | ||
"rollup": "^2.67.2", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-typescript2": "^0.31.1", | ||
"rollup-plugin-typescript2": "^0.31.2", | ||
"shallow-equal-fuzzy": "^0.0.2", | ||
"ts-jest": "^27.1.0", | ||
"ts-jest": "^27.1.3", | ||
"ts-loader": "^9.2.6", | ||
"typescript": "^4.5.2", | ||
"underscore": "^1.13.1", | ||
"webpack": "^5.64.4", | ||
"webpack-cli": "^4.9.1", | ||
"webpack-dev-server": "^4.6.0" | ||
"typescript": "^4.5.5", | ||
"underscore": "^1.13.2", | ||
"webpack": "^5.68.0", | ||
"webpack-cli": "^4.9.2", | ||
"webpack-dev-server": "^4.7.4" | ||
}, | ||
@@ -89,3 +89,3 @@ "homepage": "https://github.com/planttheidea/fast-equals#readme", | ||
"types": "index.d.ts", | ||
"version": "2.0.4" | ||
"version": "3.0.0" | ||
} |
@@ -176,5 +176,6 @@ # fast-equals | ||
type EqualityComparator = (a: any, b: any, meta?: any) => boolean; | ||
type InternalEqualityComparator = (a: any, b: any, indexOrKeyA: any, indexOrKeyB: any, parentA: any, parentB: any, meta: any) => boolean; | ||
type EqualityComparatorCreator = ( | ||
deepEqual: EqualityComparator, | ||
) => EqualityComparator; | ||
) => InternalEqualityComparator; | ||
@@ -186,4 +187,6 @@ function createCustomEqual( | ||
The `meta` parameter in `EqualityComparator` is whatever you want it to be. It will be passed through to all equality checks, and is meant specifically for use with custom equality methods. For example, with the `circularDeepEqual` and `circularShallowEqual` methods, it is used to pass through a cache of processed objects. | ||
The `meta` parameter in `EqualityComparator` and `InternalEqualityComparator` is whatever you want it to be. It will be passed through to all equality checks, and is meant specifically for use with custom equality methods. For example, with the `circularDeepEqual` and `circularShallowEqual` methods, it is used to pass through a cache of processed objects. | ||
_**NOTE**: `Map` implementations compare equality for both keys and value. When using a custom comparator and comparing equality of the keys, the iteration index is provided as both `indexOrKeyA` and `indexOrKeyB` to help use-cases where ordering of keys matters to equality._ | ||
An example for a custom equality comparison that also checks against values in the meta object: | ||
@@ -195,3 +198,3 @@ | ||
const isDeepEqualOrFooMatchesMeta = createCustomEqual( | ||
(deepEqual) => (objectA, objectB, meta) => | ||
(deepEqual) => (objectA, objectB, indexOrKeyA, indexOrKeyB, parentA, parentB, meta) => | ||
objectA.foo === meta || | ||
@@ -198,0 +201,0 @@ objectB.foo === meta || |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
142839
1312
266