fast-equals 4.0.3 → 5.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/.babelrc +34 -0
  2. package/.prettierrc +4 -0
  3. package/CHANGELOG.md +39 -0
  4. package/README.md +146 -39
  5. package/build/rollup/config.base.js +49 -0
  6. package/build/rollup/config.cjs.js +10 -0
  7. package/build/rollup/config.esm.js +10 -0
  8. package/build/rollup/config.min.js +13 -0
  9. package/build/rollup/config.umd.js +10 -0
  10. package/build/tsconfig/base.json +32 -0
  11. package/build/tsconfig/cjs.json +8 -0
  12. package/build/tsconfig/declarations.json +9 -0
  13. package/build/tsconfig/esm.json +8 -0
  14. package/build/tsconfig/min.json +8 -0
  15. package/build/tsconfig/umd.json +8 -0
  16. package/build/webpack.config.js +57 -0
  17. package/dist/cjs/index.cjs +510 -0
  18. package/dist/cjs/index.cjs.map +1 -0
  19. package/dist/cjs/types/comparator.d.ts +2 -0
  20. package/dist/cjs/types/equals.d.ts +46 -0
  21. package/dist/cjs/types/index.d.ts +56 -0
  22. package/dist/cjs/types/internalTypes.d.ts +36 -0
  23. package/dist/cjs/types/utils.d.ts +19 -0
  24. package/dist/esm/index.mjs +499 -0
  25. package/dist/esm/index.mjs.map +1 -0
  26. package/dist/esm/types/comparator.d.ts +2 -0
  27. package/dist/esm/types/equals.d.ts +46 -0
  28. package/dist/esm/types/index.d.ts +56 -0
  29. package/dist/esm/types/internalTypes.d.ts +36 -0
  30. package/dist/esm/types/utils.d.ts +19 -0
  31. package/dist/min/index.js +1 -0
  32. package/dist/min/types/comparator.d.ts +2 -0
  33. package/dist/min/types/equals.d.ts +46 -0
  34. package/dist/min/types/index.d.ts +56 -0
  35. package/dist/min/types/internalTypes.d.ts +36 -0
  36. package/dist/min/types/utils.d.ts +19 -0
  37. package/dist/umd/index.js +516 -0
  38. package/dist/umd/index.js.map +1 -0
  39. package/dist/umd/types/comparator.d.ts +2 -0
  40. package/dist/umd/types/equals.d.ts +46 -0
  41. package/dist/umd/types/index.d.ts +56 -0
  42. package/dist/umd/types/internalTypes.d.ts +36 -0
  43. package/dist/umd/types/utils.d.ts +19 -0
  44. package/index.d.ts +62 -55
  45. package/package.json +59 -38
  46. package/recipes/explicit-property-check.md +4 -6
  47. package/recipes/legacy-circular-equal-support.md +28 -20
  48. package/recipes/legacy-regexp-support.md +15 -16
  49. package/recipes/non-standard-properties.md +35 -23
  50. package/recipes/using-meta-in-comparison.md +10 -13
  51. package/src/comparator.ts +43 -40
  52. package/src/equals.ts +263 -0
  53. package/src/index.ts +183 -79
  54. package/src/internalTypes.ts +74 -0
  55. package/src/utils.ts +42 -49
  56. package/dist/fast-equals.cjs.js +0 -432
  57. package/dist/fast-equals.cjs.js.map +0 -1
  58. package/dist/fast-equals.esm.js +0 -422
  59. package/dist/fast-equals.esm.js.map +0 -1
  60. package/dist/fast-equals.js +0 -438
  61. package/dist/fast-equals.js.map +0 -1
  62. package/dist/fast-equals.min.js +0 -1
  63. package/dist/fast-equals.mjs +0 -422
  64. package/dist/fast-equals.mjs.map +0 -1
  65. package/recipes/strict-property-descriptor-check.md +0 -42
  66. package/src/arrays.ts +0 -36
  67. package/src/dates.ts +0 -12
  68. package/src/maps.ts +0 -66
  69. package/src/objects.ts +0 -62
  70. package/src/regexps.ts +0 -11
  71. package/src/sets.ts +0 -61
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../src/comparator.ts","../../src/utils.ts","../../src/equals.ts","../../src/index.ts"],"sourcesContent":["import type {\n ComparatorConfig,\n EqualityComparator,\n State,\n} from './internalTypes';\n\nconst ARGUMENTS_TAG = '[object Arguments]';\nconst BOOLEAN_TAG = '[object Boolean]';\nconst DATE_TAG = '[object Date]';\nconst MAP_TAG = '[object Map]';\nconst NUMBER_TAG = '[object Number]';\nconst OBJECT_TAG = '[object Object]';\nconst REG_EXP_TAG = '[object RegExp]';\nconst SET_TAG = '[object Set]';\nconst STRING_TAG = '[object String]';\n\nconst { isArray } = Array;\nconst getTag = Object.prototype.toString.call.bind(\n Object.prototype.toString,\n) as (a: object) => string;\n\nexport function createComparator<Meta>({\n areArraysEqual,\n areDatesEqual,\n areMapsEqual,\n areObjectsEqual,\n arePrimitiveWrappersEqual,\n areRegExpsEqual,\n areSetsEqual,\n}: ComparatorConfig<Meta>): EqualityComparator<Meta> {\n /**\n * compare the value of the two objects and return true if they are equivalent in values\n */\n return function comparator(a: any, b: any, state: State<Meta>): boolean {\n // If the items are strictly equal, no need to do a value comparison.\n if (a === b) {\n return true;\n }\n\n // If the items are not non-nullish objects, then the only possibility\n // of them being equal but not strictly is if they are both `NaN`. Since\n // `NaN` is uniquely not equal to itself, we can use self-comparison of\n // both objects, which is faster than `isNaN()`.\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {\n return a !== a && b !== b;\n }\n\n // Checks are listed in order of commonality of use-case:\n // 1. Common complex object types (plain object, array)\n // 2. Common data values (date, regexp)\n // 3. Less-common complex object types (map, set)\n // 4. Less-common data values (promise, primitive wrappers)\n // Inherently this is both subjective and assumptive, however\n // when reviewing comparable libraries in the wild this order\n // appears to be generally consistent.\n\n // `isPlainObject` only checks against the object's own realm. Cross-realm\n // comparisons are rare, and will be handled in the ultimate fallback, so\n // we can avoid the `toString.call()` cost unless necessary.\n if (a.constructor === Object && b.constructor === Object) {\n return areObjectsEqual(a, b, state);\n }\n\n // `isArray()` works on subclasses and is cross-realm, so we can again avoid\n // the `toString.call()` cost unless necessary by just checking if either\n // and then both are arrays.\n const aArray = isArray(a);\n const bArray = isArray(b);\n\n if (aArray || bArray) {\n return aArray === bArray && areArraysEqual(a, b, state);\n }\n\n // Since this is a custom object, use the classic `toString.call()` to get its\n // type. This is reasonably performant in modern environments like v8 and\n // SpiderMonkey, and allows for cross-realm comparison when other checks like\n // `instanceof` do not.\n const tag = getTag(a);\n\n if (tag !== getTag(b)) {\n return false;\n }\n\n if (tag === DATE_TAG) {\n return areDatesEqual(a, b, state);\n }\n\n if (tag === REG_EXP_TAG) {\n return areRegExpsEqual(a, b, state);\n }\n\n if (tag === MAP_TAG) {\n return areMapsEqual(a, b, state);\n }\n\n if (tag === SET_TAG) {\n return areSetsEqual(a, b, state);\n }\n\n // If a simple object tag, then we can prioritize a simple object comparison because\n // it is likely a custom class.\n if (tag === OBJECT_TAG) {\n // The exception for value comparison is `Promise`-like contracts. These should be\n // treated the same as standard `Promise` objects, which means strict equality, and if\n // it reaches this point then that strict equality comparison has already failed.\n return (\n typeof a.then !== 'function' &&\n typeof b.then !== 'function' &&\n areObjectsEqual(a, b, state)\n );\n }\n\n // If an arguments tag, it should be treated as a standard object.\n if (tag === ARGUMENTS_TAG) {\n return areObjectsEqual(a, b, state);\n }\n\n // As the penultimate fallback, check if the values passed are primitive wrappers. This\n // is very rare in modern JS, which is why it is deprioritized compared to all other object\n // types.\n if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) {\n return arePrimitiveWrappersEqual(a, b, state);\n }\n\n // If not matching any tags that require a specific type of comparison, then we hard-code false because\n // the only thing remaining is strict equality, which has already been compared. This is for a few reasons:\n // - Certain types that cannot be introspected (e.g., `WeakMap`). For these types, this is the only\n // comparison that can be made.\n // - For types that can be introspected, but rarely have requirements to be compared\n // (`ArrayBuffer`, `DataView`, etc.), the cost is avoided to prioritize the common\n // use-cases (may be included in a future release, if requested enough).\n // - For types that can be introspected but do not have an objective definition of what\n // equality is (`Error`, etc.), the subjective decision is to be conservative and strictly compare.\n // In all cases, these decisions should be reevaluated based on changes to the language and\n // common development practices.\n return false;\n };\n}\n","import {\n AnyEqualityComparator,\n BaseCircular,\n CircularState,\n Dictionary,\n EqualityComparator,\n InternalEqualityComparator,\n State,\n TypeEqualityComparator,\n} from './internalTypes';\n\nconst { getOwnPropertyNames, getOwnPropertySymbols } = Object;\nconst { hasOwnProperty } = Object.prototype;\n\nexport function combineComparators<Meta>(\n comparatorA: AnyEqualityComparator<Meta>,\n comparatorB: AnyEqualityComparator<Meta>,\n) {\n return function isEqual<A, B>(a: A, b: B, state: State<Meta>) {\n return comparatorA(a, b, state) && comparatorB(a, b, state);\n };\n}\n\n/**\n * Default equality comparator pass-through, used as the standard `isEqual` creator for\n * use inside the built comparator.\n */\nexport function createInternalComparator<Meta>(\n compare: EqualityComparator<Meta>,\n): InternalEqualityComparator<Meta> {\n return function (\n a: any,\n b: any,\n _indexOrKeyA: any,\n _indexOrKeyB: any,\n _parentA: any,\n _parentB: any,\n state: State<Meta>,\n ) {\n return compare(a, b, state);\n };\n}\n\n/**\n * Wrap the provided `areItemsEqual` method to manage the circular state, allowing\n * for circular references to be safely included in the comparison without creating\n * stack overflows.\n */\nexport function createIsCircular<\n AreItemsEqual extends TypeEqualityComparator<any, any>,\n>(areItemsEqual: AreItemsEqual): AreItemsEqual {\n return function isCircular(\n a: any,\n b: any,\n state: CircularState<BaseCircular>,\n ) {\n if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {\n return areItemsEqual(a, b, state);\n }\n\n const { cache } = state;\n\n const cachedA = cache.get(a);\n const cachedB = cache.get(b);\n\n if (cachedA && cachedB) {\n return cachedA === b && cachedB === a;\n }\n\n cache.set(a, b);\n cache.set(b, a);\n\n const result = areItemsEqual(a, b, state);\n\n cache.delete(a);\n cache.delete(b);\n\n return result;\n } as AreItemsEqual;\n}\n\nexport function getStrictProperties(\n object: Dictionary,\n): Array<string | symbol> {\n return (getOwnPropertyNames(object) as Array<string | symbol>).concat(\n getOwnPropertySymbols(object),\n );\n}\n\nexport const hasOwn =\n Object.hasOwn ||\n ((object: Dictionary, property: number | string | symbol) =>\n hasOwnProperty.call(object, property));\n\n/**\n * Whether the values passed are strictly equal or both NaN.\n */\nexport function sameValueZeroEqual(a: any, b: any): boolean {\n return a || b ? a === b : a === b || (a !== a && b !== b);\n}\n","import { getStrictProperties, hasOwn, sameValueZeroEqual } from './utils';\nimport type { Dictionary, State } from './internalTypes';\n\nconst OWNER = '_owner';\n\nconst { getOwnPropertyDescriptor, keys } = Object;\n\n/**\n * Whether the arrays are equal in value.\n */\nexport function areArraysEqual(a: any[], b: any[], state: State<any>) {\n let index = a.length;\n\n if (b.length !== index) {\n return false;\n }\n\n while (index-- > 0) {\n if (!state.equals(a[index], b[index], index, index, a, b, state)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Whether the dates passed are equal in value.\n *\n * @NOTE\n * This is a standalone function instead of done inline in the comparator\n * to allow for overrides.\n */\nexport function areDatesEqual(a: Date, b: Date): boolean {\n return sameValueZeroEqual(a.getTime(), b.getTime());\n}\n\n/**\n * Whether the `Map`s are equal in value.\n */\nexport function areMapsEqual(\n a: Map<any, any>,\n b: Map<any, any>,\n state: State<any>,\n): boolean {\n let isValueEqual = a.size === b.size;\n\n if (isValueEqual && a.size) {\n // The use of `forEach()` is to avoid the transpilation cost of `for...of` comparisons, and\n // the inability to control the performance of the resulting code. It also avoids excessive\n // iteration compared to doing comparisons of `keys()` and `values()`. As a result, though,\n // we cannot short-circuit the iterations; bookkeeping must be done to short-circuit the\n // equality checks themselves.\n\n const matchedIndices: Record<number, true> = {};\n\n let indexA = 0;\n\n a.forEach((aValue, aKey) => {\n if (!isValueEqual) {\n return;\n }\n\n let hasMatch = false;\n let matchIndexB = 0;\n\n b.forEach((bValue, bKey) => {\n if (\n !hasMatch &&\n !matchedIndices[matchIndexB] &&\n (hasMatch =\n state.equals(aKey, bKey, indexA, matchIndexB, a, b, state) &&\n state.equals(aValue, bValue, aKey, bKey, a, b, state))\n ) {\n matchedIndices[matchIndexB] = true;\n }\n\n matchIndexB++;\n });\n\n indexA++;\n isValueEqual = hasMatch;\n });\n }\n\n return isValueEqual;\n}\n\n/**\n * Whether the objects are equal in value.\n */\nexport function areObjectsEqual(\n a: Dictionary,\n b: Dictionary,\n state: State<any>,\n): boolean {\n const properties = keys(a);\n\n let index = properties.length;\n\n if (keys(b).length !== index) {\n return false;\n }\n\n let property: string | symbol;\n\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n property = properties[index]!;\n\n if (\n property === OWNER &&\n (a.$$typeof || b.$$typeof) &&\n a.$$typeof !== b.$$typeof\n ) {\n return false;\n }\n\n if (\n !hasOwn(b, property) ||\n !state.equals(a[property], b[property], property, property, a, b, state)\n ) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Whether the objects are equal in value with strict property checking.\n */\nexport function areObjectsEqualStrict(\n a: Dictionary,\n b: Dictionary,\n state: State<any>,\n): boolean {\n const properties = getStrictProperties(a);\n\n let index = properties.length;\n\n if (getStrictProperties(b).length !== index) {\n return false;\n }\n\n let property: string | symbol;\n let descriptorA: ReturnType<typeof getOwnPropertyDescriptor>;\n let descriptorB: ReturnType<typeof getOwnPropertyDescriptor>;\n\n // Decrementing `while` showed faster results than either incrementing or\n // decrementing `for` loop and than an incrementing `while` loop. Declarative\n // methods like `some` / `every` were not used to avoid incurring the garbage\n // cost of anonymous callbacks.\n while (index-- > 0) {\n property = properties[index]!;\n\n if (\n property === OWNER &&\n (a.$$typeof || b.$$typeof) &&\n a.$$typeof !== b.$$typeof\n ) {\n return false;\n }\n\n if (!hasOwn(b, property)) {\n return false;\n }\n\n if (\n !state.equals(a[property], b[property], property, property, a, b, state)\n ) {\n return false;\n }\n\n descriptorA = getOwnPropertyDescriptor(a, property);\n descriptorB = getOwnPropertyDescriptor(b, property);\n\n if (\n (descriptorA || descriptorB) &&\n (!descriptorA ||\n !descriptorB ||\n descriptorA.configurable !== descriptorB.configurable ||\n descriptorA.enumerable !== descriptorB.enumerable ||\n descriptorA.writable !== descriptorB.writable)\n ) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Whether the primitive wrappers passed are equal in value.\n *\n * @NOTE\n * This is a standalone function instead of done inline in the comparator\n * to allow for overrides.\n */\nexport function arePrimitiveWrappersEqual(a: Date, b: Date): boolean {\n return sameValueZeroEqual(a.valueOf(), b.valueOf());\n}\n\n/**\n * Whether the regexps passed are equal in value.\n *\n * @NOTE\n * This is a standalone function instead of done inline in the comparator\n * to allow for overrides. An example of this would be supporting a\n * pre-ES2015 environment where the `flags` property is not available.\n */\nexport function areRegExpsEqual(a: RegExp, b: RegExp): boolean {\n return a.source === b.source && a.flags === b.flags;\n}\n\n/**\n * Whether the `Set`s are equal in value.\n */\nexport function areSetsEqual(\n a: Set<any>,\n b: Set<any>,\n state: State<any>,\n): boolean {\n let isValueEqual = a.size === b.size;\n\n if (isValueEqual && a.size) {\n // The use of `forEach()` is to avoid the transpilation cost of `for...of` comparisons, and\n // the inability to control the performance of the resulting code. It also avoids excessive\n // iteration compared to doing comparisons of `keys()` and `values()`. As a result, though,\n // we cannot short-circuit the iterations; bookkeeping must be done to short-circuit the\n // equality checks themselves.\n\n const matchedIndices: Record<number, true> = {};\n\n a.forEach((aValue, aKey) => {\n if (!isValueEqual) {\n return;\n }\n\n let hasMatch = false;\n let matchIndex = 0;\n\n b.forEach((bValue, bKey) => {\n if (\n !hasMatch &&\n !matchedIndices[matchIndex] &&\n (hasMatch = state.equals(aValue, bValue, aKey, bKey, a, b, state))\n ) {\n matchedIndices[matchIndex] = true;\n }\n\n matchIndex++;\n });\n\n isValueEqual = hasMatch;\n });\n }\n\n return isValueEqual;\n}\n","import { createComparator } from './comparator';\nimport {\n areArraysEqual,\n areDatesEqual,\n areMapsEqual,\n areObjectsEqual,\n areObjectsEqualStrict,\n arePrimitiveWrappersEqual,\n areRegExpsEqual,\n areSetsEqual,\n} from './equals';\nimport type {\n CircularState,\n ComparatorConfig,\n CreateCustomComparatorConfig,\n CreateState,\n DefaultState,\n EqualityComparator,\n} from './internalTypes';\nimport {\n combineComparators,\n createInternalComparator,\n createIsCircular,\n sameValueZeroEqual,\n} from './utils';\n\nexport { sameValueZeroEqual };\n\ninterface DefaultEqualCreatorOptions<Meta> {\n comparator?: EqualityComparator<Meta>;\n circular?: boolean;\n strict?: boolean;\n}\n\ninterface CustomEqualCreatorOptions<Meta>\n extends DefaultEqualCreatorOptions<Meta> {\n createCustomConfig?: CreateCustomComparatorConfig<Meta>;\n createInternalComparator?: typeof createInternalComparator;\n createState?: CreateState<Meta>;\n}\n\nfunction createComparatorConfig<Meta>({\n circular,\n strict,\n}: DefaultEqualCreatorOptions<Meta>) {\n const config: ComparatorConfig<Meta> = {\n areArraysEqual,\n areDatesEqual,\n areMapsEqual,\n areObjectsEqual,\n arePrimitiveWrappersEqual,\n areRegExpsEqual,\n areSetsEqual,\n };\n\n if (strict) {\n config.areArraysEqual = areObjectsEqual;\n config.areMapsEqual = combineComparators(areMapsEqual, areObjectsEqual);\n config.areObjectsEqual = areObjectsEqualStrict;\n config.areSetsEqual = combineComparators(areSetsEqual, areObjectsEqual);\n }\n\n if (circular) {\n config.areArraysEqual = createIsCircular(config.areArraysEqual);\n config.areMapsEqual = createIsCircular(config.areMapsEqual);\n config.areObjectsEqual = createIsCircular(config.areObjectsEqual);\n config.areSetsEqual = createIsCircular(config.areSetsEqual);\n }\n\n return config;\n}\n\nfunction createDefaultEqualCreator(\n options: DefaultEqualCreatorOptions<undefined> = {},\n) {\n const config = createComparatorConfig(options);\n const isEqual = createComparator(config);\n const isEqualComparator =\n options.comparator || createInternalComparator(isEqual);\n const strict = !!options.strict;\n\n if (options.circular) {\n return function equals<A, B>(a: A, b: B): boolean {\n return isEqual(a, b, {\n cache: new WeakMap(),\n equals: isEqualComparator,\n meta: undefined,\n strict,\n });\n };\n }\n\n const state = Object.freeze({\n cache: undefined,\n equals: isEqualComparator,\n meta: undefined,\n strict,\n });\n\n return function equals<A, B>(a: A, b: B): boolean {\n return isEqual(a, b, state);\n };\n}\n\n/**\n * Whether the items passed are deeply-equal in value.\n */\nexport const deepEqual = createDefaultEqualCreator();\n\n/**\n * Whether the items passed are deeply-equal in value based on strict comparison.\n */\nexport const strictDeepEqual = createDefaultEqualCreator({ strict: true });\n\n/**\n * Whether the items passed are deeply-equal in value, including circular references.\n */\nexport const circularDeepEqual = createDefaultEqualCreator({ circular: true });\n\n/**\n * Whether the items passed are deeply-equal in value, including circular references,\n * based on strict comparison.\n */\nexport const strictCircularDeepEqual = createDefaultEqualCreator({\n circular: true,\n strict: true,\n});\n\n/**\n * Whether the items passed are shallowly-equal in value.\n */\nexport const shallowEqual = createDefaultEqualCreator({\n comparator: sameValueZeroEqual,\n});\n\n/**\n * Whether the items passed are shallowly-equal in value based on strict comparison\n */\nexport const strictShallowEqual = createDefaultEqualCreator({\n comparator: sameValueZeroEqual,\n strict: true,\n});\n\n/**\n * Whether the items passed are shallowly-equal in value, including circular references.\n */\nexport const circularShallowEqual = createDefaultEqualCreator({\n comparator: sameValueZeroEqual,\n circular: true,\n});\n\n/**\n * Whether the items passed are shallowly-equal in value, including circular references,\n * based on strict comparison.\n */\nexport const strictCircularShallowEqual = createDefaultEqualCreator({\n comparator: sameValueZeroEqual,\n circular: true,\n strict: true,\n});\n\n/**\n * Create a custom equality comparison method.\n *\n * This can be done to create very targeted comparisons in extreme hot-path scenarios\n * where the standard methods are not performant enough, but can also be used to provide\n * support for legacy environments that do not support expected features like\n * `RegExp.prototype.flags` out of the box.\n */\nexport function createCustomEqual<Meta>(\n options: CustomEqualCreatorOptions<Meta> = {},\n) {\n const {\n comparator,\n createInternalComparator: createCustomInternalComparator,\n createCustomConfig,\n createState,\n } = options;\n\n const baseConfig = createComparatorConfig(options);\n const config = createCustomConfig\n ? Object.assign({}, baseConfig, createCustomConfig(baseConfig))\n : baseConfig;\n const isEqualCustom = comparator || createComparator(config);\n const isEqualCustomComparator = createCustomInternalComparator\n ? createCustomInternalComparator(isEqualCustom)\n : createInternalComparator(isEqualCustom);\n const strict = !!options.strict;\n\n if (createState) {\n return function isEqual<A, B>(a: A, b: B, metaOverride?: Meta): boolean {\n const customState = createState(isEqualCustom);\n\n return isEqualCustom(a, b, {\n cache: customState.cache || new WeakMap(),\n equals: customState.equals || isEqualCustomComparator,\n // @ts-expect-error - inferred `Meta` may be undefined, which is okay\n meta: metaOverride !== undefined ? metaOverride : customState.meta,\n strict: customState.strict !== undefined ? customState.strict : strict,\n });\n };\n }\n\n if (options.circular) {\n return function equals<A, B>(a: A, b: B): boolean {\n return isEqualCustom(a, b, {\n cache: new WeakMap(),\n equals: isEqualCustomComparator,\n meta: undefined as Meta,\n strict,\n } as CircularState<Meta>);\n };\n }\n\n const state = Object.freeze({\n cache: undefined,\n equals: isEqualCustomComparator,\n meta: undefined,\n strict,\n });\n\n return function equals<A, B>(a: A, b: B): boolean {\n return isEqualCustom(a, b, state as DefaultState<Meta>);\n };\n}\n"],"names":[],"mappings":"AAMA,IAAM,aAAa,GAAG,oBAAoB,CAAC;AAC3C,IAAM,WAAW,GAAG,kBAAkB,CAAC;AACvC,IAAM,QAAQ,GAAG,eAAe,CAAC;AACjC,IAAM,OAAO,GAAG,cAAc,CAAC;AAC/B,IAAM,UAAU,GAAG,iBAAiB,CAAC;AACrC,IAAM,UAAU,GAAG,iBAAiB,CAAC;AACrC,IAAM,WAAW,GAAG,iBAAiB,CAAC;AACtC,IAAM,OAAO,GAAG,cAAc,CAAC;AAC/B,IAAM,UAAU,GAAG,iBAAiB,CAAC;AAE7B,IAAA,OAAO,GAAK,KAAK,CAAA,OAAV,CAAW;AAC1B,IAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAChD,MAAM,CAAC,SAAS,CAAC,QAAQ,CACD,CAAC;AAErB,SAAU,gBAAgB,CAAO,EAQd,EAAA;AAPvB,IAAA,IAAA,cAAc,oBAAA,EACd,aAAa,mBAAA,EACb,YAAY,kBAAA,EACZ,eAAe,GAAA,EAAA,CAAA,eAAA,EACf,yBAAyB,GAAA,EAAA,CAAA,yBAAA,EACzB,eAAe,GAAA,EAAA,CAAA,eAAA,EACf,YAAY,GAAA,EAAA,CAAA,YAAA,CAAA;AAEZ;;AAEG;AACH,IAAA,OAAO,SAAS,UAAU,CAAC,CAAM,EAAE,CAAM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AAE,SAAS;AACf,QAAA,MAAM,EAAA,MAAA;AACP,KAAA,CAAC,CAAC;AAEH,IAAA,OAAO,SAAS,MAAM,CAAO,CAAI,EAAE,CAAI,EAAA;QACrC,OAAO,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,KAA2B,CAAC,CAAC;AAC1D,KAAC,CAAC;AACJ;;;;"}
@@ -0,0 +1,2 @@
1
+ import type { ComparatorConfig, EqualityComparator } from './internalTypes';
2
+ export declare function createComparator<Meta>({ areArraysEqual, areDatesEqual, areMapsEqual, areObjectsEqual, arePrimitiveWrappersEqual, areRegExpsEqual, areSetsEqual, }: ComparatorConfig<Meta>): EqualityComparator<Meta>;
@@ -0,0 +1,46 @@
1
+ import type { Dictionary, State } from './internalTypes';
2
+ /**
3
+ * Whether the arrays are equal in value.
4
+ */
5
+ export declare function areArraysEqual(a: any[], b: any[], state: State<any>): boolean;
6
+ /**
7
+ * Whether the dates passed are equal in value.
8
+ *
9
+ * @NOTE
10
+ * This is a standalone function instead of done inline in the comparator
11
+ * to allow for overrides.
12
+ */
13
+ export declare function areDatesEqual(a: Date, b: Date): boolean;
14
+ /**
15
+ * Whether the `Map`s are equal in value.
16
+ */
17
+ export declare function areMapsEqual(a: Map<any, any>, b: Map<any, any>, state: State<any>): boolean;
18
+ /**
19
+ * Whether the objects are equal in value.
20
+ */
21
+ export declare function areObjectsEqual(a: Dictionary, b: Dictionary, state: State<any>): boolean;
22
+ /**
23
+ * Whether the objects are equal in value with strict property checking.
24
+ */
25
+ export declare function areObjectsEqualStrict(a: Dictionary, b: Dictionary, state: State<any>): boolean;
26
+ /**
27
+ * Whether the primitive wrappers passed are equal in value.
28
+ *
29
+ * @NOTE
30
+ * This is a standalone function instead of done inline in the comparator
31
+ * to allow for overrides.
32
+ */
33
+ export declare function arePrimitiveWrappersEqual(a: Date, b: Date): boolean;
34
+ /**
35
+ * Whether the regexps passed are equal in value.
36
+ *
37
+ * @NOTE
38
+ * This is a standalone function instead of done inline in the comparator
39
+ * to allow for overrides. An example of this would be supporting a
40
+ * pre-ES2015 environment where the `flags` property is not available.
41
+ */
42
+ export declare function areRegExpsEqual(a: RegExp, b: RegExp): boolean;
43
+ /**
44
+ * Whether the `Set`s are equal in value.
45
+ */
46
+ export declare function areSetsEqual(a: Set<any>, b: Set<any>, state: State<any>): boolean;
@@ -0,0 +1,56 @@
1
+ import type { CreateCustomComparatorConfig, CreateState, EqualityComparator } from './internalTypes';
2
+ import { createInternalComparator, sameValueZeroEqual } from './utils';
3
+ export { sameValueZeroEqual };
4
+ interface DefaultEqualCreatorOptions<Meta> {
5
+ comparator?: EqualityComparator<Meta>;
6
+ circular?: boolean;
7
+ strict?: boolean;
8
+ }
9
+ interface CustomEqualCreatorOptions<Meta> extends DefaultEqualCreatorOptions<Meta> {
10
+ createCustomConfig?: CreateCustomComparatorConfig<Meta>;
11
+ createInternalComparator?: typeof createInternalComparator;
12
+ createState?: CreateState<Meta>;
13
+ }
14
+ /**
15
+ * Whether the items passed are deeply-equal in value.
16
+ */
17
+ export declare const deepEqual: <A, B>(a: A, b: B) => boolean;
18
+ /**
19
+ * Whether the items passed are deeply-equal in value based on strict comparison.
20
+ */
21
+ export declare const strictDeepEqual: <A, B>(a: A, b: B) => boolean;
22
+ /**
23
+ * Whether the items passed are deeply-equal in value, including circular references.
24
+ */
25
+ export declare const circularDeepEqual: <A, B>(a: A, b: B) => boolean;
26
+ /**
27
+ * Whether the items passed are deeply-equal in value, including circular references,
28
+ * based on strict comparison.
29
+ */
30
+ export declare const strictCircularDeepEqual: <A, B>(a: A, b: B) => boolean;
31
+ /**
32
+ * Whether the items passed are shallowly-equal in value.
33
+ */
34
+ export declare const shallowEqual: <A, B>(a: A, b: B) => boolean;
35
+ /**
36
+ * Whether the items passed are shallowly-equal in value based on strict comparison
37
+ */
38
+ export declare const strictShallowEqual: <A, B>(a: A, b: B) => boolean;
39
+ /**
40
+ * Whether the items passed are shallowly-equal in value, including circular references.
41
+ */
42
+ export declare const circularShallowEqual: <A, B>(a: A, b: B) => boolean;
43
+ /**
44
+ * Whether the items passed are shallowly-equal in value, including circular references,
45
+ * based on strict comparison.
46
+ */
47
+ export declare const strictCircularShallowEqual: <A, B>(a: A, b: B) => boolean;
48
+ /**
49
+ * Create a custom equality comparison method.
50
+ *
51
+ * This can be done to create very targeted comparisons in extreme hot-path scenarios
52
+ * where the standard methods are not performant enough, but can also be used to provide
53
+ * support for legacy environments that do not support expected features like
54
+ * `RegExp.prototype.flags` out of the box.
55
+ */
56
+ export declare function createCustomEqual<Meta>(options?: CustomEqualCreatorOptions<Meta>): <A, B>(a: A, b: B, metaOverride?: Meta) => boolean;
@@ -0,0 +1,36 @@
1
+ export interface BaseCircular extends Pick<WeakMap<any, any>, 'delete' | 'get'> {
2
+ set(key: object, value: any): any;
3
+ }
4
+ export type State<Meta> = CircularState<Meta> | DefaultState<Meta>;
5
+ export interface CircularState<Meta> {
6
+ readonly cache: BaseCircular;
7
+ readonly equals: InternalEqualityComparator<Meta>;
8
+ meta: Meta;
9
+ readonly strict: boolean;
10
+ }
11
+ export interface DefaultState<Meta> {
12
+ readonly cache: undefined;
13
+ readonly equals: InternalEqualityComparator<Meta>;
14
+ meta: Meta;
15
+ readonly strict: boolean;
16
+ }
17
+ export interface Dictionary<Value = any> {
18
+ [key: string | symbol]: Value;
19
+ $$typeof?: any;
20
+ }
21
+ export interface ComparatorConfig<Meta> {
22
+ areArraysEqual: TypeEqualityComparator<any, Meta>;
23
+ areDatesEqual: TypeEqualityComparator<any, Meta>;
24
+ areMapsEqual: TypeEqualityComparator<any, Meta>;
25
+ areObjectsEqual: TypeEqualityComparator<any, Meta>;
26
+ arePrimitiveWrappersEqual: TypeEqualityComparator<any, Meta>;
27
+ areRegExpsEqual: TypeEqualityComparator<any, Meta>;
28
+ areSetsEqual: TypeEqualityComparator<any, Meta>;
29
+ }
30
+ export type CreateCustomComparatorConfig<Meta> = (config: ComparatorConfig<Meta>) => Partial<ComparatorConfig<Meta>>;
31
+ export type CreateState<Meta> = (comparator: EqualityComparator<Meta>) => Partial<State<Meta>>;
32
+ export type EqualityComparator<Meta> = <A, B>(a: A, b: B, state: State<Meta>) => boolean;
33
+ export type AnyEqualityComparator<Meta> = (a: any, b: any, state: State<Meta>) => boolean;
34
+ export type EqualityComparatorCreator<Meta> = (fn: EqualityComparator<Meta>) => InternalEqualityComparator<Meta>;
35
+ export type InternalEqualityComparator<Meta> = (a: any, b: any, indexOrKeyA: any, indexOrKeyB: any, parentA: any, parentB: any, state: State<Meta>) => boolean;
36
+ export type TypeEqualityComparator<Type, Meta = undefined> = (a: Type, b: Type, state: State<Meta>) => boolean;
@@ -0,0 +1,19 @@
1
+ import { AnyEqualityComparator, Dictionary, EqualityComparator, InternalEqualityComparator, State, TypeEqualityComparator } from './internalTypes';
2
+ export declare function combineComparators<Meta>(comparatorA: AnyEqualityComparator<Meta>, comparatorB: AnyEqualityComparator<Meta>): <A, B>(a: A, b: B, state: State<Meta>) => boolean;
3
+ /**
4
+ * Default equality comparator pass-through, used as the standard `isEqual` creator for
5
+ * use inside the built comparator.
6
+ */
7
+ export declare function createInternalComparator<Meta>(compare: EqualityComparator<Meta>): InternalEqualityComparator<Meta>;
8
+ /**
9
+ * Wrap the provided `areItemsEqual` method to manage the circular state, allowing
10
+ * for circular references to be safely included in the comparison without creating
11
+ * stack overflows.
12
+ */
13
+ export declare function createIsCircular<AreItemsEqual extends TypeEqualityComparator<any, any>>(areItemsEqual: AreItemsEqual): AreItemsEqual;
14
+ export declare function getStrictProperties(object: Dictionary): Array<string | symbol>;
15
+ export declare const hasOwn: (o: object, v: PropertyKey) => boolean;
16
+ /**
17
+ * Whether the values passed are strictly equal or both NaN.
18
+ */
19
+ export declare function sameValueZeroEqual(a: any, b: any): boolean;
@@ -0,0 +1 @@
1
+ !function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self)["fast-equals"]={})}(this,(function(e){"use strict";var r="[object Arguments]",t="[object Boolean]",a="[object Date]",u="[object Map]",n="[object Number]",c="[object Object]",o="[object RegExp]",i="[object Set]",f="[object String]",l=Array.isArray,s=Object.prototype.toString.call.bind(Object.prototype.toString);function p(e){var p=e.areArraysEqual,q=e.areDatesEqual,b=e.areMapsEqual,E=e.areObjectsEqual,v=e.arePrimitiveWrappersEqual,y=e.areRegExpsEqual,j=e.areSetsEqual;return function(e,g,h){if(e===g)return!0;if(!e||!g||"object"!=typeof e||"object"!=typeof g)return e!=e&&g!=g;if(e.constructor===Object&&g.constructor===Object)return E(e,g,h);var m=l(e),O=l(g);if(m||O)return m===O&&p(e,g,h);var d=s(e);return d===s(g)&&(d===a?q(e,g,h):d===o?y(e,g,h):d===u?b(e,g,h):d===i?j(e,g,h):d===c?"function"!=typeof e.then&&"function"!=typeof g.then&&E(e,g,h):d===r?E(e,g,h):(d===t||d===n||d===f)&&v(e,g,h))}}var q=Object.getOwnPropertyNames,b=Object.getOwnPropertySymbols,E=Object.prototype.hasOwnProperty;function v(e,r){return function(t,a,u){return e(t,a,u)&&r(t,a,u)}}function y(e){return function(r,t,a,u,n,c,o){return e(r,t,o)}}function j(e){return function(r,t,a){if(!r||!t||"object"!=typeof r||"object"!=typeof t)return e(r,t,a);var u=a.cache,n=u.get(r),c=u.get(t);if(n&&c)return n===t&&c===r;u.set(r,t),u.set(t,r);var o=e(r,t,a);return u.delete(r),u.delete(t),o}}function g(e){return q(e).concat(b(e))}var h=Object.hasOwn||function(e,r){return E.call(e,r)};function m(e,r){return e||r?e===r:e===r||e!=e&&r!=r}var O="_owner",d=Object.getOwnPropertyDescriptor,$=Object.keys;function w(e,r,t){var a=e.length;if(r.length!==a)return!1;for(;a-- >0;)if(!t.equals(e[a],r[a],a,a,e,r,t))return!1;return!0}function S(e,r){return m(e.getTime(),r.getTime())}function M(e,r,t){var a=e.size===r.size;if(a&&e.size){var u={},n=0;e.forEach((function(c,o){if(a){var i=!1,f=0;r.forEach((function(a,l){i||u[f]||!(i=t.equals(o,l,n,f,e,r,t)&&t.equals(c,a,o,l,e,r,t))||(u[f]=!0),f++})),n++,a=i}}))}return a}function z(e,r,t){var a,u=$(e),n=u.length;if($(r).length!==n)return!1;for(;n-- >0;){if((a=u[n])===O&&(e.$$typeof||r.$$typeof)&&e.$$typeof!==r.$$typeof)return!1;if(!h(r,a)||!t.equals(e[a],r[a],a,a,e,r,t))return!1}return!0}function A(e,r,t){var a,u,n,c=g(e),o=c.length;if(g(r).length!==o)return!1;for(;o-- >0;){if((a=c[o])===O&&(e.$$typeof||r.$$typeof)&&e.$$typeof!==r.$$typeof)return!1;if(!h(r,a))return!1;if(!t.equals(e[a],r[a],a,a,e,r,t))return!1;if(u=d(e,a),n=d(r,a),(u||n)&&(!u||!n||u.configurable!==n.configurable||u.enumerable!==n.enumerable||u.writable!==n.writable))return!1}return!0}function D(e,r){return m(e.valueOf(),r.valueOf())}function x(e,r){return e.source===r.source&&e.flags===r.flags}function C(e,r,t){var a=e.size===r.size;if(a&&e.size){var u={};e.forEach((function(n,c){if(a){var o=!1,i=0;r.forEach((function(a,f){o||u[i]||!(o=t.equals(n,a,c,f,e,r,t))||(u[i]=!0),i++})),a=o}}))}return a}function P(e){var r=e.circular,t={areArraysEqual:w,areDatesEqual:S,areMapsEqual:M,areObjectsEqual:z,arePrimitiveWrappersEqual:D,areRegExpsEqual:x,areSetsEqual:C};return e.strict&&(t.areArraysEqual=z,t.areMapsEqual=v(M,z),t.areObjectsEqual=A,t.areSetsEqual=v(C,z)),r&&(t.areArraysEqual=j(t.areArraysEqual),t.areMapsEqual=j(t.areMapsEqual),t.areObjectsEqual=j(t.areObjectsEqual),t.areSetsEqual=j(t.areSetsEqual)),t}function W(e){void 0===e&&(e={});var r=p(P(e)),t=e.comparator||y(r),a=!!e.strict;if(e.circular)return function(e,u){return r(e,u,{cache:new WeakMap,equals:t,meta:void 0,strict:a})};var u=Object.freeze({cache:void 0,equals:t,meta:void 0,strict:a});return function(e,t){return r(e,t,u)}}var k=W(),T=W({strict:!0}),R=W({circular:!0}),N=W({circular:!0,strict:!0}),B=W({comparator:m}),I=W({comparator:m,strict:!0}),V=W({comparator:m,circular:!0}),Z=W({comparator:m,circular:!0,strict:!0});e.circularDeepEqual=R,e.circularShallowEqual=V,e.createCustomEqual=function(e){void 0===e&&(e={});var r=e.comparator,t=e.createInternalComparator,a=e.createCustomConfig,u=e.createState,n=P(e),c=a?Object.assign({},n,a(n)):n,o=r||p(c),i=t?t(o):y(o),f=!!e.strict;if(u)return function(e,r,t){var a=u(o);return o(e,r,{cache:a.cache||new WeakMap,equals:a.equals||i,meta:void 0!==t?t:a.meta,strict:void 0!==a.strict?a.strict:f})};if(e.circular)return function(e,r){return o(e,r,{cache:new WeakMap,equals:i,meta:void 0,strict:f})};var l=Object.freeze({cache:void 0,equals:i,meta:void 0,strict:f});return function(e,r){return o(e,r,l)}},e.deepEqual=k,e.sameValueZeroEqual=m,e.shallowEqual=B,e.strictCircularDeepEqual=N,e.strictCircularShallowEqual=Z,e.strictDeepEqual=T,e.strictShallowEqual=I}));
@@ -0,0 +1,2 @@
1
+ import type { ComparatorConfig, EqualityComparator } from './internalTypes';
2
+ export declare function createComparator<Meta>({ areArraysEqual, areDatesEqual, areMapsEqual, areObjectsEqual, arePrimitiveWrappersEqual, areRegExpsEqual, areSetsEqual, }: ComparatorConfig<Meta>): EqualityComparator<Meta>;
@@ -0,0 +1,46 @@
1
+ import type { Dictionary, State } from './internalTypes';
2
+ /**
3
+ * Whether the arrays are equal in value.
4
+ */
5
+ export declare function areArraysEqual(a: any[], b: any[], state: State<any>): boolean;
6
+ /**
7
+ * Whether the dates passed are equal in value.
8
+ *
9
+ * @NOTE
10
+ * This is a standalone function instead of done inline in the comparator
11
+ * to allow for overrides.
12
+ */
13
+ export declare function areDatesEqual(a: Date, b: Date): boolean;
14
+ /**
15
+ * Whether the `Map`s are equal in value.
16
+ */
17
+ export declare function areMapsEqual(a: Map<any, any>, b: Map<any, any>, state: State<any>): boolean;
18
+ /**
19
+ * Whether the objects are equal in value.
20
+ */
21
+ export declare function areObjectsEqual(a: Dictionary, b: Dictionary, state: State<any>): boolean;
22
+ /**
23
+ * Whether the objects are equal in value with strict property checking.
24
+ */
25
+ export declare function areObjectsEqualStrict(a: Dictionary, b: Dictionary, state: State<any>): boolean;
26
+ /**
27
+ * Whether the primitive wrappers passed are equal in value.
28
+ *
29
+ * @NOTE
30
+ * This is a standalone function instead of done inline in the comparator
31
+ * to allow for overrides.
32
+ */
33
+ export declare function arePrimitiveWrappersEqual(a: Date, b: Date): boolean;
34
+ /**
35
+ * Whether the regexps passed are equal in value.
36
+ *
37
+ * @NOTE
38
+ * This is a standalone function instead of done inline in the comparator
39
+ * to allow for overrides. An example of this would be supporting a
40
+ * pre-ES2015 environment where the `flags` property is not available.
41
+ */
42
+ export declare function areRegExpsEqual(a: RegExp, b: RegExp): boolean;
43
+ /**
44
+ * Whether the `Set`s are equal in value.
45
+ */
46
+ export declare function areSetsEqual(a: Set<any>, b: Set<any>, state: State<any>): boolean;
@@ -0,0 +1,56 @@
1
+ import type { CreateCustomComparatorConfig, CreateState, EqualityComparator } from './internalTypes';
2
+ import { createInternalComparator, sameValueZeroEqual } from './utils';
3
+ export { sameValueZeroEqual };
4
+ interface DefaultEqualCreatorOptions<Meta> {
5
+ comparator?: EqualityComparator<Meta>;
6
+ circular?: boolean;
7
+ strict?: boolean;
8
+ }
9
+ interface CustomEqualCreatorOptions<Meta> extends DefaultEqualCreatorOptions<Meta> {
10
+ createCustomConfig?: CreateCustomComparatorConfig<Meta>;
11
+ createInternalComparator?: typeof createInternalComparator;
12
+ createState?: CreateState<Meta>;
13
+ }
14
+ /**
15
+ * Whether the items passed are deeply-equal in value.
16
+ */
17
+ export declare const deepEqual: <A, B>(a: A, b: B) => boolean;
18
+ /**
19
+ * Whether the items passed are deeply-equal in value based on strict comparison.
20
+ */
21
+ export declare const strictDeepEqual: <A, B>(a: A, b: B) => boolean;
22
+ /**
23
+ * Whether the items passed are deeply-equal in value, including circular references.
24
+ */
25
+ export declare const circularDeepEqual: <A, B>(a: A, b: B) => boolean;
26
+ /**
27
+ * Whether the items passed are deeply-equal in value, including circular references,
28
+ * based on strict comparison.
29
+ */
30
+ export declare const strictCircularDeepEqual: <A, B>(a: A, b: B) => boolean;
31
+ /**
32
+ * Whether the items passed are shallowly-equal in value.
33
+ */
34
+ export declare const shallowEqual: <A, B>(a: A, b: B) => boolean;
35
+ /**
36
+ * Whether the items passed are shallowly-equal in value based on strict comparison
37
+ */
38
+ export declare const strictShallowEqual: <A, B>(a: A, b: B) => boolean;
39
+ /**
40
+ * Whether the items passed are shallowly-equal in value, including circular references.
41
+ */
42
+ export declare const circularShallowEqual: <A, B>(a: A, b: B) => boolean;
43
+ /**
44
+ * Whether the items passed are shallowly-equal in value, including circular references,
45
+ * based on strict comparison.
46
+ */
47
+ export declare const strictCircularShallowEqual: <A, B>(a: A, b: B) => boolean;
48
+ /**
49
+ * Create a custom equality comparison method.
50
+ *
51
+ * This can be done to create very targeted comparisons in extreme hot-path scenarios
52
+ * where the standard methods are not performant enough, but can also be used to provide
53
+ * support for legacy environments that do not support expected features like
54
+ * `RegExp.prototype.flags` out of the box.
55
+ */
56
+ export declare function createCustomEqual<Meta>(options?: CustomEqualCreatorOptions<Meta>): <A, B>(a: A, b: B, metaOverride?: Meta) => boolean;
@@ -0,0 +1,36 @@
1
+ export interface BaseCircular extends Pick<WeakMap<any, any>, 'delete' | 'get'> {
2
+ set(key: object, value: any): any;
3
+ }
4
+ export type State<Meta> = CircularState<Meta> | DefaultState<Meta>;
5
+ export interface CircularState<Meta> {
6
+ readonly cache: BaseCircular;
7
+ readonly equals: InternalEqualityComparator<Meta>;
8
+ meta: Meta;
9
+ readonly strict: boolean;
10
+ }
11
+ export interface DefaultState<Meta> {
12
+ readonly cache: undefined;
13
+ readonly equals: InternalEqualityComparator<Meta>;
14
+ meta: Meta;
15
+ readonly strict: boolean;
16
+ }
17
+ export interface Dictionary<Value = any> {
18
+ [key: string | symbol]: Value;
19
+ $$typeof?: any;
20
+ }
21
+ export interface ComparatorConfig<Meta> {
22
+ areArraysEqual: TypeEqualityComparator<any, Meta>;
23
+ areDatesEqual: TypeEqualityComparator<any, Meta>;
24
+ areMapsEqual: TypeEqualityComparator<any, Meta>;
25
+ areObjectsEqual: TypeEqualityComparator<any, Meta>;
26
+ arePrimitiveWrappersEqual: TypeEqualityComparator<any, Meta>;
27
+ areRegExpsEqual: TypeEqualityComparator<any, Meta>;
28
+ areSetsEqual: TypeEqualityComparator<any, Meta>;
29
+ }
30
+ export type CreateCustomComparatorConfig<Meta> = (config: ComparatorConfig<Meta>) => Partial<ComparatorConfig<Meta>>;
31
+ export type CreateState<Meta> = (comparator: EqualityComparator<Meta>) => Partial<State<Meta>>;
32
+ export type EqualityComparator<Meta> = <A, B>(a: A, b: B, state: State<Meta>) => boolean;
33
+ export type AnyEqualityComparator<Meta> = (a: any, b: any, state: State<Meta>) => boolean;
34
+ export type EqualityComparatorCreator<Meta> = (fn: EqualityComparator<Meta>) => InternalEqualityComparator<Meta>;
35
+ export type InternalEqualityComparator<Meta> = (a: any, b: any, indexOrKeyA: any, indexOrKeyB: any, parentA: any, parentB: any, state: State<Meta>) => boolean;
36
+ export type TypeEqualityComparator<Type, Meta = undefined> = (a: Type, b: Type, state: State<Meta>) => boolean;
@@ -0,0 +1,19 @@
1
+ import { AnyEqualityComparator, Dictionary, EqualityComparator, InternalEqualityComparator, State, TypeEqualityComparator } from './internalTypes';
2
+ export declare function combineComparators<Meta>(comparatorA: AnyEqualityComparator<Meta>, comparatorB: AnyEqualityComparator<Meta>): <A, B>(a: A, b: B, state: State<Meta>) => boolean;
3
+ /**
4
+ * Default equality comparator pass-through, used as the standard `isEqual` creator for
5
+ * use inside the built comparator.
6
+ */
7
+ export declare function createInternalComparator<Meta>(compare: EqualityComparator<Meta>): InternalEqualityComparator<Meta>;
8
+ /**
9
+ * Wrap the provided `areItemsEqual` method to manage the circular state, allowing
10
+ * for circular references to be safely included in the comparison without creating
11
+ * stack overflows.
12
+ */
13
+ export declare function createIsCircular<AreItemsEqual extends TypeEqualityComparator<any, any>>(areItemsEqual: AreItemsEqual): AreItemsEqual;
14
+ export declare function getStrictProperties(object: Dictionary): Array<string | symbol>;
15
+ export declare const hasOwn: (o: object, v: PropertyKey) => boolean;
16
+ /**
17
+ * Whether the values passed are strictly equal or both NaN.
18
+ */
19
+ export declare function sameValueZeroEqual(a: any, b: any): boolean;