- #201 - Fixed
URLcomparisons ignoring query strings. Query parameter order remains insignificant, with repeated keys counted. - #201 - Fixed
Errorcomparisons ignoring own enumerable properties. - #201 - Fixed
Error.causeto compare by value and added circular reference tracking for errors. - #201 - Fixed boxed
BigIntvalues to compare by value rather than identity. - #201 - Fixed
TypedArraycomparisons to treatNaNas equal to itself, matching SameValueZero semantics.## 5.4.2
- #202 - Fixed
URLcomparisons ignoring query strings. Query parameter order remains insignificant, with repeated keys counted. - #202 - Fixed
Errorcomparisons ignoring own enumerable properties. - #202 - Fixed
Error.causeto compare by value and added circular reference tracking for errors. - #202 - Fixed
TypedArraycomparisons to treatNaNas equal to itself, matching SameValueZero semantics. - #202 - Use
lengthinstead ofbyteLengthto boundTypedArraycomparisons, avoiding redundant iterations on non-8-bit views.
- #197 - Remove transitive dependencies with security vulnerabilities
- #198 - Update build tools to improve consumer typings
- #195 - Use
.lengthinstead ofbyteLengthfor TypedArrays, which avoids V8 slow path on non-8-bit arrays - #195 - Use
Uint8Arrayinstead ofArrayformatchedIndicesstorage for denser uninitialized loads - #195 - Avoid unnecessary
concatwhen no symbols exist on strict comparisons
- #164 - Drop UMD support and distribution of source maps (see #161 for reasoning)
- #166 - Remove
unsupportedTagComparatorsobject in favor ofgetUnsupportedCustomComparatormethod - Add
sameValueEqualmethod (Object.iswith ponyfill for legacy environments) and make it the default number comparison (formerly usedsameValueZeroEqual) - #170 - Add
strictEqualmethod for convenience and completeness
BigIntsupport added (uses same handlers as normal numbers)- Faster!
- More flexibility for methods not included by default via
getUnsupportedCustomComparator
- #163 - Fix handling of
TypedArray-based checks, and addareArrayBuffersEqualandareDataViewsEqualto checks
- Update build infrastructure to ensure legacy types align with types built from source code
- #154 - Use include with
"files"instead of exclude with.npmignore(Thanks @43081j) - #155 - Upgrade build dependencies to resolve security vulnerabilities
- #153 - Avoid publishing
.yarnfolder
- #150 - Add support for
unknownTagComparatorsin custom configuration (thanks to @mrcljx for the idea)
- #139 - Add file extensions to type definition files to
allow it to work in projects with
NodeNextmodule resolution
- #138 - Actually fix reference to
srccode inindex.d.tsby flattening types in file
- Support Preact objects in equality comparison
- #137 - Fix circular React references in object comparisons
- #136 - More than double speed of iterables (
Map/Set) equality comparisons
- #135 - Include
dequalanddequal/litein benchmark comparisons
Re-release of 5.1.0 with correct pre-release setup.
DO NOT USE
This was an accidental pre-release when cleaning up release setup.
- #127 - Add support for custom
Functioninstance comparisons (resolves #118) - #128 - Add support for
URLinstance comparisons (resolves #121) - #129 - Add support for
Errorinstance comparisons (resolves #123) - #130 - Add support for custom
Numberinstance comparisons (resolves #112)
- #132 - Fix
assert.deepEqualcheck in benchmark (resolves #125) - #126 - Export explicit types via
export type(attempts to resolve #114)
- Fix reference to
metaOverridein typings and documentation (holdover from temporary API in v5 beta)
To align with other implementations common in the community, but also to be more functionally correct, the two objects
being compared now must have equal constructors.
In previous verisons, .forEach() was used to ensure that support for Symbol was not required, as IE11 did not have
Symbol and therefore both Map and Set did not have iterator-based methods such as .values() or .entries().
Since IE11 is no longer a supported browser, and support for those methods is present in all browsers and Node for quite
a while, the comparison has moved to use these methods. This results in a ~20% performance increase.
To better facilitate strict comparisons, but also to allow for meta use separate from caching, the contract for
createCustomEqual has changed. See the README documentation for more details, but
froma high-level:
metais no longer passed through to equality comparators, but rather a generalstateobject which containsmetacachenow also lives on thestateobject, which allows for use of themetaproperty separate from but in parallel with the circular cacheequalsis now onstate, which prevents the need to pass through the separateisEqualmethod for the equality comparator
You can create a custom circular equality comparator through createCustomEqual now by providing circular: true to
the options.
To use meta properties for comparisons, they must be returned in a createState method.
If you were deep-linking into a specific asset type (ESM / CJS / UMD), they have changed location.
NOTE: You may no longer need to deep-link, as the build resolution has improved.
The following new comparators are available:
strictDeepEqualstrictShallowEqualstrictCircularDeepEqualstrictCircularShallowEqual
This will perform the same comparisons as their non-strict counterparts, but will verify additional properties
(non-enumerable properties on objects, keyed objects on Array / Map / Set) and that the descriptors for the
properties align.
Support for comparing all typed array values is now supported, and you can provide a custom comparator via the new
areTypedArraysEqual option in the createCustomEqual configuration.
The library now leverages the exports property in the package.json to provide builds specific to your method of
consumption (ESM / CommonJS / UMD). There is still a minified UMD version available if you want to use it instead.
If you want a custom comparator for primitive wrappers (new Boolean() / new Number() / new String()) it is now
available.
- Remove unnecessary second strict equality check for objects in edge-case scenarios
- #85 -
createCustomCircularEqualtyping is incorrect
- #81 - Fix typing issues related to importing in
index.d.tsfile
In previous versions, there were automatic fallbacks for certain ES2015 features if they did not exist:
Due to the omnipresence of support in both browser and NodeJS, these have been deprecated. There is still an option if
you require support for these legacy environments, however; see createCustomEqual and
createCustomCircularEqual for more details.
To allow more flexibility and customizability for a variety of edge cases, createCustomEqual now allows override of
specific type value comparisons in addition to the general comparator it did prior. See
the documentation for more details.
Like createCustomEqual, it will create a custom equality comparator, with the exception that it will handle circular
references. See the documentation for more details.
Prior to 4.x.x., instanceof was used internally for checking of object classes, which only worked when comparing
objects from the same Realm. This has changed to instead use
an object's
StringTag, which
is not realm-specific.
For better typing in edge-case scenarios like custom comparators with meta values, typings have been refactored for
accuracy and better narrow flow-through.
- Fix #77 - better circular object validation
- Fix #73 - support comparison of primitive wrappers
- #76 - improve speed and accuracy of
RegExpcomparison in modern environments
- Fix #71 - use generic types for better type flow-through
When creating a custom equality comparator via createCustomEqual, the equality method has an expanded contract:
// 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 - support additional metadata for custom equality comparators
- Fix #58 - duplicate entries in
Map/Setcan create false equality success - #60 - Add documentation for key equality of
Mapbeing a part ofdeepEqual
- Fix #50 - copy-pasta in cacheable check
- Optimize iterables comparisons to not double-iterate
- Optimize loop-based comparisons for speed
- Improve cache handling in circular handlers
- Improve stability of memory by reducing variable instantiation
- Fix #41 - prevent
.rpt2_cachedirectory from being published for better CI environment support (thanks @herberttn)
- There are longer
fast-equals/es,fast-equals/lib,fast-equals/mjslocations- Instead, there are 3 builds in
distfor different consumption types:fast-equals.js(UMD /browser)fast-equals.esm.js(ESM /module)fast-equals.cjs.js(CommonJS /main)
- Instead, there are 3 builds in
- There is no default export anymore, only the previously-existing named exports
- To get all into a namespace, use
import * as fe from 'fast-equals
- To get all into a namespace, use
- Rewritten completely in TypeScript
- Improve speed of
Map/Setcomparisons - Improve speed of React element comparisons
- Consider pure objects (
Object.create(null)) to be plain objects - Fix typings for
createCustomEqual
- Check the size of the iterable before converting to arrays
- Fix #23 - false positives for map
- Replace
uglifywithterser - Use
rollupto build all the distributables (main,module, andbrowser)- Maintain
libandestranspilations in case consumers were deep-linking
- Maintain
- Upgrade to
babel@7 - Add
"sideEffects": falsetopackage.jsonfor better tree-shaking inwebpack
- Add ESM support for NodeJS with separate
.mjsextension exports
- Fix
Map/Setcomparison to not require order to match to be equal
- Improve speed of object comparison through custom
hasKeymethod
- Fix lack of support for
unicodeandstickyRegExp flag checks
- Add
circularDeepEqualandcircularShallowEqualmethods - Add
metathird parameter tocomparatorcalls, for use withcreateCustomEqualmethod
- Fix issue where
lastIndexwas not being tested onRegExpobjects
- Add support for comparing promise-like objects (strict equality only)
- Make
reactcomparison more accurate, and a touch faster
- Add support for deep-equal comparisons between
reactelements - Add comparison with
react-fast-compare - Use
rollupfordistfile builds
- Fix errors from TypeScript typings in strict mode (thanks @HitoriSensei)
- Surface
isSameValueZeroassameValueZeroEqualoption
- Add TypeScript typings (thanks @josh-sachs)
- Support invalid date equality via
isSameValueZero
- Replace
isStrictlyEqualwithisSameValueZeroto ensure thatshallowEqualaccounts forNaNequality
- Only check values when comparing
Setobjects (improves performance ofSetcheck by ~12%)
- Make
MapandSetcomparisons more explicit
- Fix symmetrical comparison of iterables
- Reduce footprint
- Prevent babel transpilation of
typeofinto helper for faster runtime
- Initial release