deep-equal
Advanced tools
Comparing version 1.1.1 to 1.1.2
208
CHANGELOG.md
@@ -8,4 +8,204 @@ # Changelog | ||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). | ||
## [v2.2.2](https://github.com/inspect-js/node-deep-equal/compare/v2.2.1...v2.2.2) - 2023-07-10 | ||
### Commits | ||
- [Fix] avoid an infinite loop in node 0.8 with Typed Arrays [`f247282`](https://github.com/inspect-js/node-deep-equal/commit/f247282e66060087c51221f77b9170fa0e2e461b) | ||
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`fa25583`](https://github.com/inspect-js/node-deep-equal/commit/fa255839c1afed228c41ca76177a8c239ec9305a) | ||
- [Deps] update `get-intrinsic` [`3638470`](https://github.com/inspect-js/node-deep-equal/commit/3638470e71ed6185e06a0f0694e77cbf4c2b791c) | ||
## [v2.2.1](https://github.com/inspect-js/node-deep-equal/compare/v2.2.0...v2.2.1) - 2023-04-27 | ||
### Commits | ||
- [Tests] add passing tests covering object key ordering [`51c9ff6`](https://github.com/inspect-js/node-deep-equal/commit/51c9ff6b4c5d4371e0f444ce1160e416bf88e21f) | ||
- [Refactor] use `array-buffer-byte-length` [`f47822c`](https://github.com/inspect-js/node-deep-equal/commit/f47822cf0c188caa71dfbb107b081324fcb6b99d) | ||
- [Deps] update `is-array-buffer`, `regexp.prototype.flags` [`160d851`](https://github.com/inspect-js/node-deep-equal/commit/160d8513335d63256f9826835b35d1a462c76771) | ||
- [Deps] update `es-get-iterator`, `get-intrinsic` [`2e08e95`](https://github.com/inspect-js/node-deep-equal/commit/2e08e956a43c839246d2280cfaaa3f3200937bbd) | ||
- [Dev Deps] update `object.getownpropertydescriptors` [`63e9ab7`](https://github.com/inspect-js/node-deep-equal/commit/63e9ab7450212bf7e393c1bf725293389cb4626a) | ||
- [Dev Deps] update `tape` [`c8db964`](https://github.com/inspect-js/node-deep-equal/commit/c8db964f605834388b0df20c5fce49cfbaa541bc) | ||
## [v2.2.0](https://github.com/inspect-js/node-deep-equal/compare/v2.1.0...v2.2.0) - 2023-01-05 | ||
### Commits | ||
- [New] add support for `SharedArrayBuffer` [`0ef51c7`](https://github.com/inspect-js/node-deep-equal/commit/0ef51c79b7dcd6ae5890b2dce4304be7c8ebe314) | ||
- [Refactor] use `is-array-buffer` package [`0360ee1`](https://github.com/inspect-js/node-deep-equal/commit/0360ee1f1bb6e5804c15a9a4aa75ff84120a33e1) | ||
- [Fix] `whichTypedArray` can return false in both cases [`df3e3c4`](https://github.com/inspect-js/node-deep-equal/commit/df3e3c4e30552b7a7892b62dc45fccd31eac9bfe) | ||
- [Dev Deps] update `aud`, `object.getownpropertydescriptors` [`6d62ea4`](https://github.com/inspect-js/node-deep-equal/commit/6d62ea4f2b82d4f861fd3e0c2d67916939b1edbc) | ||
- [Dev Deps] update `@ljharb/eslint-config` [`15aab59`](https://github.com/inspect-js/node-deep-equal/commit/15aab59d647628e05b77d1897036d73884f7a107) | ||
- [Deps] update `which-typed-array` [`8dfce27`](https://github.com/inspect-js/node-deep-equal/commit/8dfce27f333721c697b90569b26e4bded0d61d88) | ||
- [eslint] remove `.eslintignore` [`af46773`](https://github.com/inspect-js/node-deep-equal/commit/af46773b281dc67d7743280505a22248f0f0748d) | ||
## [v2.1.0](https://github.com/inspect-js/node-deep-equal/compare/v2.0.5...v2.1.0) - 2022-11-02 | ||
### Fixed | ||
- [New] add support for `ArrayBuffer` [`#94`](https://github.com/inspect-js/node-deep-equal/issues/94) | ||
### Commits | ||
- [actions] reuse common workflows [`12de287`](https://github.com/inspect-js/node-deep-equal/commit/12de2873def84c621421b1e3d4a96babf2ceb30a) | ||
- [actions] use `node/install` instead of `node/run`; use `codecov` action [`ec248b9`](https://github.com/inspect-js/node-deep-equal/commit/ec248b96f4f91eb4c5971dfec74d6d91f04b39cd) | ||
- [Tests] run assert tests on a dynamic matrix [`695aebd`](https://github.com/inspect-js/node-deep-equal/commit/695aebd50945621984bfa7e60b5c99f79dbacf1a) | ||
- [readme] add badges [`492e159`](https://github.com/inspect-js/node-deep-equal/commit/492e1591585233184151b5526cf5413e61a2aa89) | ||
- [Test] ArrayBuffers in node < 0.12 have a nonconfigurable own `byteLength` property [`40f4b87`](https://github.com/inspect-js/node-deep-equal/commit/40f4b8719658f6262399b24791d4ccb5960ca8ea) | ||
- [meta] use `npmignore` to autogenerate an npmignore file [`2627269`](https://github.com/inspect-js/node-deep-equal/commit/26272693147d68ec3ae2216b1f3ac5d30b79b3da) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`7a05bb7`](https://github.com/inspect-js/node-deep-equal/commit/7a05bb7482817616243fc89956abf48710d77fea) | ||
- [Deps] update `call-bind`, `es-get-iterator`, `get-intrinsic`, `is-arguments`, `is-regex`, `regexp.prototype.flags`, `side-channel`, `which-boxed-primitive`, `which-typed-array` [`c0844e6`](https://github.com/inspect-js/node-deep-equal/commit/c0844e629ba3dc5193fd41a75ebcedaba976c1af) | ||
- [actions] update codecov uploader [`b1b0552`](https://github.com/inspect-js/node-deep-equal/commit/b1b0552fe3dc23029a2717f84642e53548902e68) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `has-symbols`, `object.getownpropertydescriptors`, `tape` [`9a1ccf5`](https://github.com/inspect-js/node-deep-equal/commit/9a1ccf5285317962fe37baa211c2b20081be71ef) | ||
- [meta] do not publish github action workflow files [`2d63384`](https://github.com/inspect-js/node-deep-equal/commit/2d63384d6676b593c2a74b45747ac81cea3da76e) | ||
- [actions] update rebase action to use reusable workflow [`69d21f5`](https://github.com/inspect-js/node-deep-equal/commit/69d21f55af0bcff1c41447a6ac396ae556fda226) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `has-symbols`, `object.getownpropertydescriptors`, `tape` [`297aae8`](https://github.com/inspect-js/node-deep-equal/commit/297aae88f619b1e058418be32e37fc29770b4f21) | ||
- [Tests] add tests for regexes with the same source but different flags [`29c8a0d`](https://github.com/inspect-js/node-deep-equal/commit/29c8a0da09567b3bbe6614c1e235d5a87d7bdaf2) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`9e64ec9`](https://github.com/inspect-js/node-deep-equal/commit/9e64ec93a8c5cbe87315d30dd62a8fe6dcf842b4) | ||
- [Deps] update `is-arguments`, `is-date-object`, `is-regex`, `which-typed-array` [`edfb752`](https://github.com/inspect-js/node-deep-equal/commit/edfb752810699790c06bb424174f38b449a4b8fb) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog`, `tape` [`7b5f7a3`](https://github.com/inspect-js/node-deep-equal/commit/7b5f7a348b2bb78ca1c00003d0dd3444d5a372a6) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `has-typed-arrays`, `tape` [`e328a23`](https://github.com/inspect-js/node-deep-equal/commit/e328a237ba9c262d8c2d178a65d5e1f744cbbd6b) | ||
- [Deps] update `get-intrinsic`, `regexp.prototype.flags`, `which-typed-array` [`29123a7`](https://github.com/inspect-js/node-deep-equal/commit/29123a71857c27cce497ac991fa9be0e5921adce) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud` [`b7039ef`](https://github.com/inspect-js/node-deep-equal/commit/b7039effc1b751cb579095f9738ee019d8458a41) | ||
- [Dev Deps] update `aud`, `tape` [`9d0b2e0`](https://github.com/inspect-js/node-deep-equal/commit/9d0b2e07df24dfd1d4d9bf32cdca07e6e1377f23) | ||
- [actions] update workflows [`a5f5a7e`](https://github.com/inspect-js/node-deep-equal/commit/a5f5a7ed570e35cefad08ed32652cb8647d0166c) | ||
- [Deps] update `get-intrinsic`, `object.assign` [`02025e2`](https://github.com/inspect-js/node-deep-equal/commit/02025e21dfbce6a4d52421c4892ba743dd7a7540) | ||
- [Test] node < 4 lacks `ArrayBuffer.prototype.fill` [`bb65b07`](https://github.com/inspect-js/node-deep-equal/commit/bb65b07d39eeea03ca066a92892a06a607641ed7) | ||
- [Deps] update `is-date-object`, `is-regex` [`a463ed2`](https://github.com/inspect-js/node-deep-equal/commit/a463ed26ba7ca4b818db4929e4e946ddc0590bce) | ||
- [Deps] update `get-intrinsic`, `object-is` [`2a33cce`](https://github.com/inspect-js/node-deep-equal/commit/2a33cced17827df191676ecdd9b9bc4f0d814aa6) | ||
- [actions] update workflows [`d905278`](https://github.com/inspect-js/node-deep-equal/commit/d90527855a35bcaeef70d3e21370580d7d182c8d) | ||
- [meta] use `prepublishOnly` script for npm 7+ [`7b66184`](https://github.com/inspect-js/node-deep-equal/commit/7b661846aedb0ad5768f1118e93c662d214c85f8) | ||
- [Dev Deps] update `object.getownpropertydescriptors` [`d970dbc`](https://github.com/inspect-js/node-deep-equal/commit/d970dbcf4a95c58d5bbd6ea507455bbfa1e7ec02) | ||
## [v2.0.5](https://github.com/inspect-js/node-deep-equal/compare/v2.0.4...v2.0.5) - 2020-12-01 | ||
### Commits | ||
- [Tests] migrate tests to Github Actions [`4051a18`](https://github.com/inspect-js/node-deep-equal/commit/4051a1811612fd1b107743a092402361f597f89a) | ||
- [meta] add Automatic Rebase and Require Allow Edits workflows [`6682b15`](https://github.com/inspect-js/node-deep-equal/commit/6682b15417630d6c57c854d088dfcd6023b3e185) | ||
- [Deps] use `call-bind` and `get-intrinsic` instead of `es-abstract`; update `es-get-iterator`, `object-is`, `object.assign` [`a1d6d93`](https://github.com/inspect-js/node-deep-equal/commit/a1d6d931ebc80db8a6dba1bd453165356458f9e1) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object.getownpropertydescriptors` [`b142f4b`](https://github.com/inspect-js/node-deep-equal/commit/b142f4b9458c320b944dc06f57b9339530cf404e) | ||
## [v2.0.4](https://github.com/inspect-js/node-deep-equal/compare/v2.0.3...v2.0.4) - 2020-10-01 | ||
### Fixed | ||
- [meta] fix incorrect `./package.json` exports entry [`#89`](https://github.com/inspect-js/node-deep-equal/issues/89) | ||
### Commits | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog` [`d6bfee3`](https://github.com/inspect-js/node-deep-equal/commit/d6bfee329e2a430a12e6a4aba7006c5d7c36020e) | ||
- [Tests] account for node 14+ making two NaNs loosely deep equal [`9367954`](https://github.com/inspect-js/node-deep-equal/commit/93679546d97dbd92d615b0f758d733ea1fb4eb4b) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`86a159b`](https://github.com/inspect-js/node-deep-equal/commit/86a159b72c3e3620285498113251220d3c5d05f0) | ||
- [Deps] update `es-abstract`, `object-is`, `object.assign` [`e87979d`](https://github.com/inspect-js/node-deep-equal/commit/e87979d311faa537622a6c9faee6e91cf9a08bcd) | ||
- [Deps] update `es-abstract`, `is-regex` [`d0cacca`](https://github.com/inspect-js/node-deep-equal/commit/d0cacca140b963d8abbe10f6bf640f22ef11f7b0) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`375a9e1`](https://github.com/inspect-js/node-deep-equal/commit/375a9e1e4911b3210e328365432c8cf946d0a7e2) | ||
- [Dev Deps] update `eslint`, `auto-changelog` [`e562d4f`](https://github.com/inspect-js/node-deep-equal/commit/e562d4fadebf09b1fca02d6f43e1c933c6ef8242) | ||
- [Deps] update `side-channel` [`f092342`](https://github.com/inspect-js/node-deep-equal/commit/f092342373d4a33b3f679042f357fd800185caad) | ||
## [v2.0.3](https://github.com/inspect-js/node-deep-equal/compare/v2.0.2...v2.0.3) - 2020-04-23 | ||
### Commits | ||
- [Deps] update `object-is`, `which-typed-array` [`c232374`](https://github.com/inspect-js/node-deep-equal/commit/c2323741001f7cb2414f4fa26301f1b9705e6b46) | ||
- [Dev Deps] update `auto-changelog`; add `aud` [`c80a91d`](https://github.com/inspect-js/node-deep-equal/commit/c80a91d8b9815300fc9e24f08094cac8942d9da7) | ||
- [Dev Deps] update `auto-changelog` [`295d195`](https://github.com/inspect-js/node-deep-equal/commit/295d19529365a87ed663eecf26f19effe5b06f3c) | ||
- [Dev Deps] update `aud` [`1134cc2`](https://github.com/inspect-js/node-deep-equal/commit/1134cc26fd112e3679a6973f4d418c4495e3358d) | ||
- [Deps] Fix classification of `object.assign` [`32695dd`](https://github.com/inspect-js/node-deep-equal/commit/32695dd88c3eb86c87e162830e0e1c55447a4b9f) | ||
## [v2.0.2](https://github.com/inspect-js/node-deep-equal/compare/v2.0.1...v2.0.2) - 2020-04-01 | ||
### Commits | ||
- [Fix] properly pass `strict` option through internals [`4e2919d`](https://github.com/inspect-js/node-deep-equal/commit/4e2919d7c403413a9cf094b2f3be095653670e97) | ||
- [Tests] add more coverage [`a3d8677`](https://github.com/inspect-js/node-deep-equal/commit/a3d86774fa39e1a00b3371a32fbe42c7b38743ff) | ||
- [Tests] add coverage reporting [`3174e33`](https://github.com/inspect-js/node-deep-equal/commit/3174e33f952a4bdd57c43e3b40dea705d3d61e68) | ||
- [Refactor] add strict pragma; remove unused try/catch [`c1d173e`](https://github.com/inspect-js/node-deep-equal/commit/c1d173ebadfcc4a2574f28b17727239dcd2737be) | ||
- [Fix] the `prototype` property is not special on non-functions [`1c3cc25`](https://github.com/inspect-js/node-deep-equal/commit/1c3cc2526766e52cc32b9c1859b7073d5dbb70aa) | ||
- [Deps] update `es-abstract`, `es-get-iterator`, `is-date-object`, `is-regex`, `object-is`, `regexp.prototype.flags`, `side-channel` [`7787bdc`](https://github.com/inspect-js/node-deep-equal/commit/7787bdc1268620ef12d17777fce3682abc4e364e) | ||
- [Deps] update `es-abstract`, `es-get-iterator`, `which-collection` [`87624cf`](https://github.com/inspect-js/node-deep-equal/commit/87624cf96f2ca00bf5200aa860c4574dba96f4aa) | ||
- [Fix] robustly distinguish Typed Arrays [`7ccb2b0`](https://github.com/inspect-js/node-deep-equal/commit/7ccb2b0f88136516cd58cad74d9c0a20daad824c) | ||
- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`c1814a1`](https://github.com/inspect-js/node-deep-equal/commit/c1814a1256e373ac6e7953b354f9f56ff5b7fe89) | ||
- [Dev Deps] update `@ljharb/eslint-config`, `object.getownpropertydescriptors`, `tape` [`7a0d819`](https://github.com/inspect-js/node-deep-equal/commit/7a0d819e5b3807eab873d7961eb34e30ff615943) | ||
- [Dev Deps] update `auto-changelog`, `tape` [`f248756`](https://github.com/inspect-js/node-deep-equal/commit/f2487567b092d90005a7d09b084f7ffb9ba71257) | ||
- [Tests] fix `tag` helper, from bb50ea2e6d7906cd58683fdc7d327660e71612f4 [`469f008`](https://github.com/inspect-js/node-deep-equal/commit/469f0089d16d8678ee4c5f57016d40f072b3f7be) | ||
- [Dev Deps] update `eslint`, `tape` [`6537dce`](https://github.com/inspect-js/node-deep-equal/commit/6537dcef16c792546c3a40ea5b53ab43861cf719) | ||
- [Fix] make `isBuffer` check slightly more robust [`c21e14d`](https://github.com/inspect-js/node-deep-equal/commit/c21e14d7afe7d53391fa95fd8c59f85affc02ac6) | ||
- [meta] disable greenkeeper updates for semver [`724f051`](https://github.com/inspect-js/node-deep-equal/commit/724f051213e159d5a021d0649e6a2cafd4c13458) | ||
- [Deps] update `es-abstract` [`942ad86`](https://github.com/inspect-js/node-deep-equal/commit/942ad8699442dd83207bb04ae079997b3433ca60) | ||
- [Deps] update `es-abstract` [`8724052`](https://github.com/inspect-js/node-deep-equal/commit/8724052e10d2e897626af6f46e0bce9d35523b04) | ||
## [v2.0.1](https://github.com/inspect-js/node-deep-equal/compare/v2.0.0...v2.0.1) - 2019-12-08 | ||
### Fixed | ||
- [Fix] `Map` and `Set` comparison: keys are loosely compared also [`#75`](https://github.com/inspect-js/node-deep-equal/issues/75) | ||
### Commits | ||
- [Fix] check extra properties on regexps [`1eac46b`](https://github.com/inspect-js/node-deep-equal/commit/1eac46b69c7b499cecb7e3b555b6e260de2043fd) | ||
- [Tests] update test skipping logic [`8adf08d`](https://github.com/inspect-js/node-deep-equal/commit/8adf08dcb91146590f2c57b614de6a853054f297) | ||
## [v2.0.0](https://github.com/inspect-js/node-deep-equal/compare/v1.1.2...v2.0.0) - 2019-12-03 | ||
### Fixed | ||
- [Fix] handle circular references [`#19`](https://github.com/inspect-js/node-deep-equal/issues/19) | ||
- [Breaking] compare `Map`, `Set`, `WeakMap`, `WeakSet` matching node assert [`#54`](https://github.com/inspect-js/node-deep-equal/issues/54) [`#46`](https://github.com/inspect-js/node-deep-equal/issues/46) | ||
- [Breaking] compare `Map`, `Set`, `WeakMap`, `WeakSet` matching node assert [`#54`](https://github.com/inspect-js/node-deep-equal/issues/54) [`#46`](https://github.com/inspect-js/node-deep-equal/issues/46) | ||
- [Breaking] comparing arrays and objects should always fail, per node‘s assert.deepEqual [`#12`](https://github.com/inspect-js/node-deep-equal/issues/12) | ||
### Commits | ||
- [Tests] add passing tests from node core [`91a6472`](https://github.com/inspect-js/node-deep-equal/commit/91a6472719331eca1b13472db798e7f3188af9f7) | ||
- [Tests] convert remaining tests to use the custom assertion [`2bb7269`](https://github.com/inspect-js/node-deep-equal/commit/2bb7269013574a9a4e84ec5e34a04258f3ecd94a) | ||
- [Tests] add tests for getters, fake arrays, overriding getTime on Dates [`1b66d90`](https://github.com/inspect-js/node-deep-equal/commit/1b66d90232a5a576d0334f0c109f8c79da487c9f) | ||
- [Breaking] non-Date objects with different [[Prototypes]] are not equal [`5f2f2e5`](https://github.com/inspect-js/node-deep-equal/commit/5f2f2e55a3cfea251ca502a7846489a9133b4347) | ||
- [Breaking] boxed primitives are not silently unboxed [`e207bc3`](https://github.com/inspect-js/node-deep-equal/commit/e207bc352f338a5c57b2ef2ce59d78b821fb2b58) | ||
- [Tests] run tests with assert, as well [`ccaf3ea`](https://github.com/inspect-js/node-deep-equal/commit/ccaf3eabb081d255f9fafcf2cc2631eafaa9b2a7) | ||
- [Breaking] boxed primitives are unwrapped for comparisons [`a159a3a`](https://github.com/inspect-js/node-deep-equal/commit/a159a3a0660a2da9a8ff6392aba4b2de81bc8391) | ||
- [Refactor] use `side-channel` for memoizing circular refs [`983780a`](https://github.com/inspect-js/node-deep-equal/commit/983780aec338b8d909c3f6a5b1e0f4d7fe1d78b5) | ||
- [Tests] Failing tests for Map equality [`4856185`](https://github.com/inspect-js/node-deep-equal/commit/4856185d989914e2f440fe3fd3bac4d977365fe2) | ||
- [Tests] add `toStringTag` helper [`bb50ea2`](https://github.com/inspect-js/node-deep-equal/commit/bb50ea2e6d7906cd58683fdc7d327660e71612f4) | ||
- [Fix] robustly unbox boxed primitives, using `unbox-primitive` [`c455998`](https://github.com/inspect-js/node-deep-equal/commit/c45599893f02f349604a7b39b39f45036ea2e499) | ||
- [Breaking] two objects with different `Symbol.toStringTag`s are not equal [`45431b6`](https://github.com/inspect-js/node-deep-equal/commit/45431b67b5e7e9cb91d5ff8706dc55348d59184e) | ||
- [Tests] add more Error tests [`c0ae38c`](https://github.com/inspect-js/node-deep-equal/commit/c0ae38c43872621da83aba608cd62b951de7c4c6) | ||
- [Breaking] ensure `Error` objects compare properly [`ffb2522`](https://github.com/inspect-js/node-deep-equal/commit/ffb2522eb94afe46a8ccc23faebdcee23ea6f170) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`737031e`](https://github.com/inspect-js/node-deep-equal/commit/737031e9ac09812ec7181040e857d8b73b573970) | ||
- [readme] update URLs, readme [`9d300da`](https://github.com/inspect-js/node-deep-equal/commit/9d300da78ce21dcca7259bb557765cfac0db3e16) | ||
- [Tests] use `Buffer.from` when available [`43fa5da`](https://github.com/inspect-js/node-deep-equal/commit/43fa5dafe17b1287f56c2566c487a9c05946fe4f) | ||
- [Breaking] add `exports` to `package.json` [`ecd15ae`](https://github.com/inspect-js/node-deep-equal/commit/ecd15aedeeddc8f386ed8b54296648ee4a73af9b) | ||
- [Tests] require ASSERT tests to pass [`7ac77cf`](https://github.com/inspect-js/node-deep-equal/commit/7ac77cf21081b30eeadb5ac5201b30ad0d4dcbe4) | ||
- [Robustness] use `callBound` from `es-abstract` [`4dc3477`](https://github.com/inspect-js/node-deep-equal/commit/4dc347792be1f7131b3095ba98590a599cce7e20) | ||
- [patch] [[Prototype]]s are only compared in strict mode [`43b1eef`](https://github.com/inspect-js/node-deep-equal/commit/43b1eef2eb7bc3045fb160bf5d755bce44cbfd52) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `has-symbols` [`89228df`](https://github.com/inspect-js/node-deep-equal/commit/89228df447b174008e163f1c83c8f0f559e30fa0) | ||
- [Tests] up to `node` `v12.9` [`595c81a`](https://github.com/inspect-js/node-deep-equal/commit/595c81a2e2c1baab216b2dac640ed020f49033bf) | ||
- [Fix] pass options when comparing Collection keys/values [`9859584`](https://github.com/inspect-js/node-deep-equal/commit/9859584ae2f4f46ec602e18bac9610c71ff00e2f) | ||
- [Breaking] `false` and `[]` are no longer equal, even non-strictly [`5c3accc`](https://github.com/inspect-js/node-deep-equal/commit/5c3acccf541ba0b77342c2a441b32a43acebc73e) | ||
- [Tests] only use `Buffer.from` when it has a length of > 1 [`3645129`](https://github.com/inspect-js/node-deep-equal/commit/3645129d7692c5195ae4b94ba83d2fe84d9538d7) | ||
- [Breaking] remove `lib/is-arguments` and `lib/keys` entrypoints [`783d47e`](https://github.com/inspect-js/node-deep-equal/commit/783d47e3092b7a62aaecbf6836b18a0dfca96662) | ||
- [Dev Deps] update `eslint` [`7cc1dd9`](https://github.com/inspect-js/node-deep-equal/commit/7cc1dd986fc30946ca06ba6496ef856cfb911cf3) | ||
- Merge tag 'v1.1.1' [`f9d3c6d`](https://github.com/inspect-js/node-deep-equal/commit/f9d3c6d1e4a895c448ba7d8766f8616d0e235c9a) | ||
- Merge tag 'v1.1.0' [`0aeca99`](https://github.com/inspect-js/node-deep-equal/commit/0aeca9988dba6fe3318f46c47c933e6926175278) | ||
## [v1.1.2](https://github.com/inspect-js/node-deep-equal/compare/v1.1.1...v1.1.2) - 2023-11-08 | ||
### Commits | ||
- [Tests] port tests from main; only diff should be true/falses [`e02cadb`](https://github.com/inspect-js/node-deep-equal/commit/e02cadb650ef9d75684c015a35d2c59e029d5174) | ||
- [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `aud`, `eslint`, `set-publish-latest`, `tape` [`11bd45b`](https://github.com/inspect-js/node-deep-equal/commit/11bd45b63943466c13a5ae97276796396a8f2619) | ||
- [Tests] update `.github` from default branch [`58885d3`](https://github.com/inspect-js/node-deep-equal/commit/58885d3280fd25909ca5a17c7cec1e54bdd25233) | ||
- [readme] update readme from default branch [`b0bca9a`](https://github.com/inspect-js/node-deep-equal/commit/b0bca9a1158a9596ec51a0404a6a8272b70ee204) | ||
- [Tests] add `nyc` for coverage [`e25bc37`](https://github.com/inspect-js/node-deep-equal/commit/e25bc3716c7ec0390b06bd7b6fac0c9ab0968ab4) | ||
- [Tests] use `Buffer.from` when available [`f0d4a42`](https://github.com/inspect-js/node-deep-equal/commit/f0d4a42fb87854e17d78cb2d6e9ec0156ea3d2f3) | ||
- [Deps] update `is-arguments`, `is-date-object`, `is-regex`, `object-is`, `regexp.prototype.flags` [`80c15ca`](https://github.com/inspect-js/node-deep-equal/commit/80c15cae82164c888de8635287c3b44ab84b3fd4) | ||
- [meta] use `npmignore` to autogenerate an npmignore file [`e0770e5`](https://github.com/inspect-js/node-deep-equal/commit/e0770e594ec683ded32fd1b14e876f087fc04f4a) | ||
- [Deps] update `is-date-object`, `is-regex`, `object-is`, `regexp.prototype.flags` [`e4fb8c6`](https://github.com/inspect-js/node-deep-equal/commit/e4fb8c6459aa13d3a110b45e5612c31890a5d94e) | ||
- [Tests] handle ported test failures in iojs v2 [`3798ff4`](https://github.com/inspect-js/node-deep-equal/commit/3798ff490286ee9ba70cf50c339914be355eea18) | ||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`0f8ca75`](https://github.com/inspect-js/node-deep-equal/commit/0f8ca7575e44c66fdf1dc2b6ad4e69e1b549369f) | ||
- [Tests] handle some additional test differences in node <= 0.10 [`197a220`](https://github.com/inspect-js/node-deep-equal/commit/197a2203f0a95828c62ff2b3c980ddf16736913c) | ||
- [meta] add missing `engines.node` [`e158993`](https://github.com/inspect-js/node-deep-equal/commit/e158993fcf913aca8a1ffdc037abfeeb3a5cb4e5) | ||
- [meta] update `.gitignore` from default branch [`6ee186b`](https://github.com/inspect-js/node-deep-equal/commit/6ee186bd39199a1c05421e200b1e8e31a83cf363) | ||
- [Dev Deps] update `tape` [`270d34b`](https://github.com/inspect-js/node-deep-equal/commit/270d34b48401ee40792bf18d06614044246776dd) | ||
- [meta] fix URLs [`a269c18`](https://github.com/inspect-js/node-deep-equal/commit/a269c183bccb78dfdd2c88a149fe5373f13af4c0) | ||
- [Tests] only use `Buffer.from` when it has a length of > 1 [`f7e5776`](https://github.com/inspect-js/node-deep-equal/commit/f7e577622d943da78c2c9cd1e070eb786cf7a68b) | ||
## [v1.1.1](https://github.com/inspect-js/node-deep-equal/compare/v1.1.0...v1.1.1) - 2019-11-12 | ||
@@ -21,3 +221,3 @@ | ||
## [v1.1.0](https://github.com/inspect-js/node-deep-equal/compare/v1.0.1...v1.1.0) - 2019-08-28 | ||
## [v1.1.0](https://github.com/inspect-js/node-deep-equal/compare/v1.0.1...v1.1.0) - 2019-08-27 | ||
@@ -80,3 +280,3 @@ ### Commits | ||
## [v0.1.2](https://github.com/inspect-js/node-deep-equal/compare/v0.1.1...v0.1.2) - 2013-12-21 | ||
## [v0.1.2](https://github.com/inspect-js/node-deep-equal/compare/v0.1.1...v0.1.2) - 2013-12-20 | ||
@@ -116,3 +316,3 @@ ### Commits | ||
## v0.0.0 - 2012-02-11 | ||
## v0.0.0 - 2012-02-10 | ||
@@ -119,0 +319,0 @@ ### Commits |
{ | ||
"name": "deep-equal", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "node's assert.deepEqual algorithm", | ||
@@ -12,8 +12,10 @@ "main": "index.js", | ||
"scripts": { | ||
"prepublish": "safe-publish-latest", | ||
"prepack": "npmignore --auto --commentLines=autogenerated", | ||
"prepublish": "not-in-publish || npm run prepublishOnly", | ||
"prepublishOnly": "safe-publish-latest", | ||
"pretest": "npm run lint", | ||
"lint": "eslint .", | ||
"tests-only": "tape test/*", | ||
"lint": "eslint --ext=js,mjs .", | ||
"tests-only": "nyc tape 'test/**/*.js'", | ||
"test": "npm run tests-only", | ||
"posttest": "npx aud", | ||
"posttest": "aud --production", | ||
"version": "auto-changelog && git add CHANGELOG.md", | ||
@@ -23,19 +25,27 @@ "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" | ||
"dependencies": { | ||
"is-arguments": "^1.0.4", | ||
"is-date-object": "^1.0.1", | ||
"is-regex": "^1.0.4", | ||
"object-is": "^1.0.1", | ||
"is-arguments": "^1.1.1", | ||
"is-date-object": "^1.0.5", | ||
"is-regex": "^1.1.4", | ||
"object-is": "^1.1.5", | ||
"object-keys": "^1.1.1", | ||
"regexp.prototype.flags": "^1.2.0" | ||
"regexp.prototype.flags": "^1.5.1" | ||
}, | ||
"devDependencies": { | ||
"@ljharb/eslint-config": "^15.0.1", | ||
"auto-changelog": "^1.16.2", | ||
"eslint": "^6.6.0", | ||
"safe-publish-latest": "^1.1.4", | ||
"tape": "^4.11.0" | ||
"@ljharb/eslint-config": "^21.1.0", | ||
"aud": "^2.0.3", | ||
"auto-changelog": "^2.4.0", | ||
"define-data-property": "^1.1.1", | ||
"eslint": "=8.8.0", | ||
"has-typed-arrays": "^1.0.1", | ||
"in-publish": "^2.0.1", | ||
"npmignore": "^0.3.0", | ||
"nyc": "^10.3.2", | ||
"object.getownpropertydescriptors": "^2.1.7", | ||
"safe-publish-latest": "^2.0.0", | ||
"semver": "^6.3.1", | ||
"tape": "^5.7.2" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/substack/node-deep-equal.git" | ||
"url": "http://github.com/inspect-js/node-deep-equal.git" | ||
}, | ||
@@ -56,2 +66,5 @@ "keywords": [ | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">= 0.4" | ||
}, | ||
"testling": { | ||
@@ -88,4 +101,13 @@ "files": "test/*.js", | ||
"commitLimit": false, | ||
"backfillLimit": false | ||
"backfillLimit": false, | ||
"hideCredit": true | ||
}, | ||
"browser": { | ||
"assert.js": false | ||
}, | ||
"publishConfig": { | ||
"ignore": [ | ||
".github/workflows" | ||
] | ||
} | ||
} |
@@ -0,11 +1,32 @@ | ||
'use strict'; | ||
var Test = require('tape/lib/test'); | ||
var is = require('object-is'); | ||
var equal = require('../'); | ||
var deepEqual = require('../'); | ||
var assert = require('../assert'); | ||
var equal = process.env.ASSERT ? function assertDeepEqual(a, b, options) { | ||
try { | ||
if (options && options.strict) { | ||
assert.deepStrictEqual(a, b); | ||
} else { | ||
assert.deepEqual(a, b); | ||
} | ||
} catch (e) { | ||
return false; | ||
} | ||
return true; | ||
} : deepEqual; | ||
function equalReversed(t, a, b, isEqual, msg, isStrict, skipReversed) { | ||
var actual = isStrict ? equal(a, b, { strict: true }) : equal(a, b); | ||
var actual = isStrict | ||
? equal(a, b, { strict: true }) | ||
: equal(a, b); | ||
var suffix = isEqual ? ' are equal' : ' are not equal'; | ||
t.equal(actual, !!isEqual, msg + suffix); | ||
if (typeof skipReversed === 'boolean' ? !skipReversed : !is(a, b)) { | ||
var actualReverse = isStrict ? equal(b, a, { strict: true }) : equal(b, a); | ||
var actualReverse = isStrict | ||
? equal(b, a, { strict: true }) | ||
: equal(b, a); | ||
t.equal(actualReverse, !!isEqual, msg + suffix + ' (reversed)'); | ||
@@ -12,0 +33,0 @@ } |
1095
test/cmp.js
@@ -0,6 +1,30 @@ | ||
'use strict'; | ||
var test = require('tape'); | ||
require('./_tape'); | ||
var assign = require('object.assign'); | ||
var gOPDs = require('object.getownpropertydescriptors'); | ||
var hasSymbols = require('has-symbols')(); | ||
var hasTypedArrays = require('has-typed-arrays')(); | ||
var semver = require('semver'); | ||
var keys = require('object-keys'); | ||
var availableTypedArrays = require('available-typed-arrays')(); | ||
var forEach = require('for-each'); | ||
var hasProto = require('has-proto')(); | ||
var defineDataProperty = require('define-data-property'); | ||
var equal = require('../'); | ||
var safeBuffer = typeof Buffer === 'function' ? Buffer.from && Buffer.from.length > 1 ? Buffer.from : Buffer : null; | ||
var buffersAreTypedArrays = typeof Buffer === 'function' && new Buffer(0) instanceof Uint8Array; | ||
var isNode = typeof process === 'object' && typeof process.version === 'string'; | ||
function tag(obj, value) { | ||
if (hasSymbols && Symbol.toStringTag && Object.defineProperty) { | ||
Object.defineProperty(obj, Symbol.toStringTag, { | ||
value: value | ||
}); | ||
} | ||
return obj; | ||
} | ||
test('equal', function (t) { | ||
@@ -15,5 +39,297 @@ t.deepEqualTest( | ||
); | ||
var obj1 = { a: [2, 3], b: [4] }; | ||
var obj2 = { b: [4], a: [2, 3] }; | ||
t.notDeepEqual(keys(obj1), keys(obj2), 'keys are in a different order'); | ||
t.deepEqual(keys(obj1), keys(obj2).reverse(), 'keys are in opposite order'); | ||
t.deepEqualTest( | ||
obj1, | ||
obj2, | ||
'two equal objects, in different order', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
{ a: 2, b: '4' }, | ||
{ a: 2, b: 4 }, | ||
'two loosely equal, strictly inequal objects', | ||
true, | ||
false | ||
); | ||
t.deepEqualTest( | ||
{ a: 2, b: 4 }, | ||
{ a: 2, B: 4 }, | ||
'two inequal objects', | ||
false, | ||
false | ||
); | ||
t.deepEqualTest( | ||
'-000', | ||
false, | ||
'`false` and `"-000"`', | ||
true, | ||
false | ||
); | ||
t.end(); | ||
}); | ||
test('Maps', { skip: typeof Map !== 'function' }, function (t) { | ||
t.deepEqualTest( | ||
new Map([['a', 1], ['b', 2]]), | ||
new Map([['b', 2], ['a', 1]]), | ||
'two equal Maps', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Map([['a', [1, 2]]]), | ||
new Map([['a', [2, 1]]]), | ||
'two Maps with inequal values on the same key', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Map([['a', 1]]), | ||
new Map([['b', 1]]), | ||
'two inequal Maps', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Map([[{}, 3], [{}, 2], [{}, 1]]), | ||
new Map([[{}, 1], [{}, 2], [{}, 3]]), | ||
'two equal Maps in different orders with object keys', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Map([[undefined, undefined]]), | ||
new Map([[undefined, null]]), | ||
'undefined keys, nullish values, loosely equal, strictly inequal', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Map([[{}, null], [true, 2], [{}, 1], [undefined, {}]]), | ||
new Map([[{}, 1], [true, 2], [{}, null], [undefined, {}]]), | ||
'two equal Maps in different orders with primitive keys', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Map([[false, 3], [{}, 2], [{}, 1]]), | ||
new Map([[{}, 1], [{}, 2], [false, 3]]), | ||
'two equal Maps in different orders with a mix of keys', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Map([[null, undefined]]), | ||
new Map([[null, null]]), | ||
'null keys, nullish values, loosely equal, strictly inequal', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Map([[undefined, 3]]), | ||
new Map([[null, 3]]), | ||
'nullish keys, loosely equal, strictly inequal', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Map([[{}, null], [true, 2], [{}, 1], [undefined, {}]]), | ||
new Map([[{}, 1], [true, 2], [{}, null], [undefined, {}]]), | ||
'two equal Maps in different orders with primitive keys', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Map([[false, 3], [{}, 2], [{}, 1]]), | ||
new Map([[{}, 1], [{}, 2], [false, 3]]), | ||
'two equal Maps in different orders with a mix of keys', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Map(), | ||
new Map([[{}, 1]]), | ||
'two inequal Maps', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Map([[{}, null], [false, 3]]), | ||
new Map([[{}, null], [true, 2]]), | ||
'two inequal maps, same size, primitive key, start with object key', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Map([[false, 3], [{}, null]]), | ||
new Map([[true, 2], [{}, null]]), | ||
'two inequal maps, same size, primitive key, start with primitive key', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Map([[undefined, null], ['+000', 2]]), | ||
new Map([[null, undefined], [false, '2']]), | ||
'primitive comparisons', | ||
true, | ||
true | ||
); | ||
t.end(); | ||
}); | ||
test('WeakMaps', { skip: typeof WeakMap !== 'function' }, function (t) { | ||
t.deepEqualTest( | ||
new WeakMap([[Object, null], [Function, true]]), | ||
new WeakMap([[Function, true], [Object, null]]), | ||
'two equal WeakMaps', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new WeakMap([[Object, null]]), | ||
new WeakMap([[Object, true]]), | ||
'two WeakMaps with inequal values on the same key', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new WeakMap([[Object, null], [Function, true]]), | ||
new WeakMap([[Object, null]]), | ||
'two inequal WeakMaps', | ||
true, | ||
true | ||
); | ||
t.end(); | ||
}); | ||
test('Sets', { skip: typeof Set !== 'function' }, function (t) { | ||
t.deepEqualTest( | ||
new Set(['a', 1, 'b', 2]), | ||
new Set(['b', 2, 'a', 1]), | ||
'two equal Sets', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Set(['a', 1]), | ||
new Set(['b', 1]), | ||
'two inequal Sets', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Set([{}, 1, {}, {}, 2]), | ||
new Set([{}, 1, {}, 2, {}]), | ||
'two equal Sets in different orders', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Set(), | ||
new Set([1]), | ||
'two inequally sized Sets', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Set([{ a: 1 }, 2]), | ||
new Set(['2', { a: '1' }]), | ||
'two loosely equal, strictly inequal Sets', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Set([{ a: 1 }, 2]), | ||
new Set(['2', { a: 2 }]), | ||
'two inequal Sets', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Set([null, '', 1, 5, 2, false]), | ||
new Set([undefined, 0, '5', true, '2', '-000']), | ||
'more primitive comparisons', | ||
true, | ||
true | ||
); | ||
t.end(); | ||
}); | ||
test('Set and Map', { skip: !Object.defineProperty || typeof Set !== 'function' || typeof Map !== 'function' }, function (t) { | ||
t.deepEqualTest( | ||
new Set(), | ||
new Map(), | ||
'Map and Set', | ||
true, | ||
true | ||
); | ||
var maplikeSet = new Set(); | ||
Object.defineProperty(maplikeSet, 'constructor', { enumerable: false, value: Map }); | ||
maplikeSet.__proto__ = Map.prototype; // eslint-disable-line no-proto | ||
t.deepEqualTest( | ||
maplikeSet, | ||
new Map(), | ||
'Map-like Set, and Map', | ||
true, | ||
true | ||
); | ||
t.end(); | ||
}); | ||
test('WeakSets', { skip: typeof WeakSet !== 'function' }, function (t) { | ||
t.deepEqualTest( | ||
new WeakSet([Object, Function]), | ||
new WeakSet([Function, Object]), | ||
'two equal WeakSets', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new WeakSet([Object, Function]), | ||
new WeakSet([Object]), | ||
'two inequal WeakSets', | ||
true, | ||
true | ||
); | ||
t.end(); | ||
}); | ||
test('not equal', function (t) { | ||
@@ -27,2 +343,3 @@ t.deepEqualTest( | ||
); | ||
t.end(); | ||
@@ -76,5 +393,10 @@ }); | ||
} | ||
t.ok( | ||
equal(getArgs(1, 2, 3), getArgs(1, 2, 3)), | ||
'equivalent arguments objects are equal' | ||
t.deepEqualTest( | ||
getArgs(1, 2, 3), | ||
getArgs(1, 2, 3), | ||
'equivalent arguments objects are equal', | ||
true, | ||
true, | ||
true | ||
); | ||
@@ -90,20 +412,102 @@ | ||
var args = getArgs(); | ||
var notArgs = tag({ length: 0 }, 'Arguments'); | ||
t.deepEqualTest( | ||
args, | ||
notArgs, | ||
'args and similar arraylike object', | ||
false, | ||
false | ||
); | ||
t.end(); | ||
}); | ||
test('dates', function (t) { | ||
test('Dates', function (t) { | ||
var d0 = new Date(1387585278000); | ||
var d1 = new Date('Fri Dec 20 2013 16:21:18 GMT-0800 (PST)'); | ||
t.deepEqualTest(d0, d1, 'equivalent Dates', true, true); | ||
t.deepEqualTest(d0, d1, 'two Dates with the same timestamp', true, true); | ||
d1.a = true; | ||
t.deepEqualTest(d0, d1, 'two Dates with the same timestamp but different own properties', true, true); | ||
t.test('overriding `getTime`', { skip: !Object.defineProperty }, function (st) { | ||
var a = new Date('2000'); | ||
var b = new Date('2000'); | ||
Object.defineProperty(a, 'getTime', { value: function () { return 5; } }); | ||
st.deepEqualTest(a, b, 'two Dates with the same timestamp but one has overridden `getTime`', true, true); | ||
st.end(); | ||
}); | ||
t.test('fake Date', { skip: !hasProto }, function (st) { | ||
var a = new Date(2000); | ||
var b = tag(Object.create( | ||
a.__proto__, // eslint-disable-line no-proto | ||
gOPDs(a) | ||
), 'Date'); | ||
st.deepEqualTest( | ||
a, | ||
b, | ||
'Date, and fake Date', | ||
true, | ||
true | ||
); | ||
st.end(); | ||
}); | ||
var a = new Date('2000'); | ||
var b = new Date('2000'); | ||
b.foo = true; | ||
t.deepEqualTest( | ||
a, | ||
b, | ||
'two identical Dates, one with an extra property', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
new Date('2000'), | ||
new Date('2001'), | ||
'two inequal Dates', | ||
false, | ||
false | ||
); | ||
t.end(); | ||
}); | ||
test('buffers', function (t) { | ||
test('buffers', { skip: typeof Buffer !== 'function' }, function (t) { | ||
/* eslint no-buffer-constructor: 1, new-cap: 1 */ | ||
t.ok(equal(Buffer('xyz'), Buffer('xyz')), 'buffers with same contents are equal'); | ||
t.ok(equal(Buffer('xyz'), Buffer('xyz'), { strict: true }), 'strict: buffers with same contents are equal'); | ||
t.deepEqualTest( | ||
safeBuffer('xyz'), | ||
safeBuffer('xyz'), | ||
'buffers with same contents are equal', | ||
true, | ||
true | ||
); | ||
t.deepEqualTest( | ||
Buffer('abc'), | ||
Buffer('xyz'), | ||
safeBuffer('xyz'), | ||
safeBuffer('xyy'), | ||
'buffers with same length and different contents are inequal', | ||
false, | ||
false | ||
); | ||
t.deepEqualTest( | ||
safeBuffer('xyz'), | ||
safeBuffer('xy'), | ||
'buffers with different length are inequal', | ||
false, | ||
false | ||
); | ||
t.deepEqualTest( | ||
safeBuffer('abc'), | ||
safeBuffer('xyz'), | ||
'buffers with different contents', | ||
@@ -114,4 +518,6 @@ false, | ||
var emptyBuffer = safeBuffer(''); | ||
t.deepEqualTest( | ||
Buffer(''), | ||
emptyBuffer, | ||
[], | ||
@@ -123,5 +529,97 @@ 'empty buffer and empty array', | ||
t.test('bufferlikes', { skip: !Object.defineProperty || !hasTypedArrays }, function (st) { | ||
var fakeBuffer = { | ||
0: 'a', | ||
length: 1, | ||
__proto__: emptyBuffer.__proto__, // eslint-disable-line no-proto | ||
copy: emptyBuffer.copy, | ||
slice: emptyBuffer.slice | ||
}; | ||
Object.defineProperty(fakeBuffer, '0', { enumerable: false }); | ||
Object.defineProperty(fakeBuffer, 'length', { enumerable: false }); | ||
Object.defineProperty(fakeBuffer, 'copy', { enumerable: false }); | ||
Object.defineProperty(fakeBuffer, 'slice', { enumerable: false }); | ||
st.deepEqualTest( | ||
safeBuffer('a'), | ||
fakeBuffer, | ||
'real buffer, and mildly fake buffer', | ||
false, | ||
false | ||
); | ||
st.test('bufferlike', { skip: buffersAreTypedArrays ? !hasSymbols || !Symbol.toStringTag : false }, function (s2t) { | ||
var bufferlike = buffersAreTypedArrays ? new Uint8Array() : {}; | ||
Object.defineProperty(bufferlike, 'length', { | ||
enumerable: false, | ||
value: bufferlike.length || 0 | ||
}); | ||
Object.defineProperty(bufferlike, 'copy', { | ||
enumerable: false, | ||
value: emptyBuffer.copy | ||
}); | ||
bufferlike.__proto__ = emptyBuffer.__proto__; // eslint-disable-line no-proto | ||
s2t.deepEqualTest( | ||
emptyBuffer, | ||
bufferlike, | ||
'empty buffer and empty bufferlike', | ||
true, | ||
true | ||
); | ||
s2t.end(); | ||
}); | ||
st.end(); | ||
}); | ||
t.end(); | ||
}); | ||
test('Arrays', function (t) { | ||
var a = []; | ||
var b = []; | ||
b.foo = true; | ||
t.deepEqualTest( | ||
a, | ||
b, | ||
'two identical arrays, one with an extra property', | ||
false, | ||
false | ||
); | ||
t.end(); | ||
}); | ||
test('booleans', function (t) { | ||
t.deepEqualTest( | ||
true, | ||
true, | ||
'trues', | ||
true, | ||
true, | ||
false | ||
); | ||
t.deepEqualTest( | ||
false, | ||
false, | ||
'falses', | ||
true, | ||
true, | ||
false | ||
); | ||
t.deepEqualTest( | ||
true, | ||
false, | ||
'true and false', | ||
false, | ||
false | ||
); | ||
t.end(); | ||
}); | ||
test('booleans and arrays', function (t) { | ||
@@ -147,35 +645,41 @@ t.deepEqualTest( | ||
var a0 = [ | ||
undefined, | ||
null, | ||
-1, | ||
0, | ||
1, | ||
false, | ||
true, | ||
undefined, | ||
'', | ||
'abc', | ||
null, | ||
undefined | ||
], | ||
a1 = [ | ||
undefined, | ||
null, | ||
-1, | ||
0, | ||
1, | ||
false, | ||
true, | ||
undefined, | ||
'', | ||
'abc', | ||
null, | ||
undefined | ||
]; | ||
undefined, | ||
null, | ||
-1, | ||
0, | ||
1, | ||
false, | ||
true, | ||
undefined, | ||
'', | ||
'abc', | ||
null, | ||
undefined | ||
]; | ||
var a1 = [ | ||
undefined, | ||
null, | ||
-1, | ||
0, | ||
1, | ||
false, | ||
true, | ||
undefined, | ||
'', | ||
'abc', | ||
null, | ||
undefined | ||
]; | ||
t.ok(equal(a0, a1)); | ||
t.deepEqualTest( | ||
a0, | ||
a1, | ||
'arrays with equal contents are equal', | ||
true, | ||
true, | ||
true | ||
); | ||
t.end(); | ||
}); | ||
// eslint-disable-next-line max-statements | ||
test('arrays assigned', function (t) { | ||
@@ -216,3 +720,2 @@ var a0 = [ | ||
// eslint-disable-next-line max-statements | ||
test('arrays push', function (t) { | ||
@@ -255,2 +758,3 @@ var a0 = [ | ||
t.deepEqualTest(null, undefined, 'null and undefined', true, false); | ||
t.deepEqualTest([null], [undefined], '[null] and [undefined]', true, false); | ||
@@ -260,11 +764,22 @@ t.end(); | ||
// node 14 changed `deepEqual` to make two NaNs loosely equal. TODO, semver-major: change deep-equal in the same way. | ||
var isNode14 = isNode && process.env.ASSERT && semver.satisfies(process.version, '>= 14'); | ||
test('NaNs', function (t) { | ||
t.notOk(equal(NaN, NaN), 'NaN is not NaN'); | ||
t.ok(equal(NaN, NaN, { strict: true }), 'strict: NaN is NaN'); | ||
t.deepEqualTest( | ||
NaN, | ||
NaN, | ||
'two NaNs', | ||
isNode14, | ||
true | ||
); | ||
t.notOk(equal({ a: NaN }, { a: NaN }), 'two equiv objects with a NaN value are not equiv'); | ||
t.ok(equal({ a: NaN }, { a: NaN }, { strict: true }), 'strict: two equiv objects with a NaN value are equiv'); | ||
t.deepEqualTest( | ||
{ a: NaN }, | ||
{ a: NaN }, | ||
'two equiv objects with a NaN value', | ||
isNode14, | ||
true | ||
); | ||
t.notOk(equal(NaN, 1), 'NaN !== 1'); | ||
t.notOk(equal(NaN, 1, { strict: true }), 'strict: NaN !== 1'); | ||
t.deepEqualTest(NaN, 1, 'NaN and 1', false, false); | ||
@@ -336,5 +851,50 @@ t.end(); | ||
t.test('fake RegExp', { skip: !hasProto }, function (st) { | ||
var a = /abc/g; | ||
var b = tag(Object.create( | ||
a.__proto__, // eslint-disable-line no-proto | ||
gOPDs(a) | ||
), 'RegExp'); | ||
st.deepEqualTest(a, b, 'regex and fake regex', false, false); | ||
st.end(); | ||
}); | ||
var a = /abc/gi; | ||
var b = /abc/gi; | ||
b.foo = true; | ||
t.deepEqualTest( | ||
a, | ||
b, | ||
'two identical regexes, one with an extra property', | ||
true, | ||
true | ||
); | ||
var c = /abc/g; | ||
var d = /abc/i; | ||
t.deepEqualTest( | ||
c, | ||
d, | ||
'two regexes with the same source but different flags', | ||
false, | ||
false | ||
); | ||
t.end(); | ||
}); | ||
test('object literals', function (t) { | ||
t.deepEqualTest( | ||
{ prototype: 2 }, | ||
{ prototype: '2' }, | ||
'two loosely equal, strictly inequal prototype properties', | ||
false, | ||
false | ||
); | ||
t.end(); | ||
}); | ||
test('arrays and objects', function (t) { | ||
@@ -352,5 +912,444 @@ t.deepEqualTest([], {}, 'empty array and empty object', true, true); | ||
t.deepEqualTest(f, f, 'a function and itself', true, true, true); | ||
t.deepEqualTest([f], [f], 'a function and itself in an array', true, true, true); | ||
t.deepEqualTest(function () {}, function () {}, 'two distinct functions', false, false, true); | ||
t.deepEqualTest([function () {}], [function () {}], 'two distinct functions in an array', false, false, true); | ||
t.deepEqualTest(f, {}, 'function and object', false, false, true); | ||
t.deepEqualTest([f], [{}], 'function and object in an array', false, false, true); | ||
t.end(); | ||
}); | ||
test('Errors', function (t) { | ||
t.deepEqualTest(new Error('xyz'), new Error('xyz'), 'two errors of the same type with the same message', true, true, false); | ||
t.deepEqualTest(new Error('xyz'), new TypeError('xyz'), 'two errors of different types with the same message', true, true); | ||
t.deepEqualTest(new Error('xyz'), new Error('zyx'), 'two errors of the same type with a different message', true, true); | ||
t.test('errorlike', { skip: !Object.defineProperty }, function (st) { | ||
var err = new Error('foo'); | ||
// TODO: add `__proto__` when brand check is available | ||
var errorlike = tag({ message: err.message, stack: err.stack, name: err.name, constructor: err.constructor }, 'Error'); | ||
Object.defineProperty(errorlike, 'message', { enumerable: false }); | ||
Object.defineProperty(errorlike, 'stack', { enumerable: false }); | ||
Object.defineProperty(errorlike, 'name', { enumerable: false }); | ||
Object.defineProperty(errorlike, 'constructor', { enumerable: false }); | ||
st.notOk(errorlike instanceof Error); | ||
st.ok(err instanceof Error); | ||
st.deepEqualTest( | ||
err, | ||
errorlike, | ||
'error, and errorlike object', | ||
true, | ||
true | ||
); | ||
st.end(); | ||
}); | ||
t.deepEqualTest( | ||
new Error('a'), | ||
assign(new Error('a'), { code: 10 }), | ||
'two otherwise equal errors with different own properties', | ||
false, | ||
false | ||
); | ||
t.test('fake error', { skip: !process.env.ASSERT || !hasProto }, function (st) { | ||
var a = tag({ | ||
__proto__: null | ||
}, 'Error'); | ||
var b = new RangeError('abc'); | ||
b.__proto__ = null; // eslint-disable-line no-proto | ||
st.deepEqualTest( | ||
a, | ||
b, | ||
'null object faking as an Error, RangeError with null proto', | ||
false, | ||
false | ||
); | ||
st.end(); | ||
}); | ||
t.end(); | ||
}); | ||
test('object and null', function (t) { | ||
t.deepEqualTest( | ||
{}, | ||
null, | ||
'null and an object', | ||
false, | ||
false | ||
); | ||
t.end(); | ||
}); | ||
test('errors', function (t) { | ||
t.end(); | ||
}); | ||
test('error = Object', function (t) { | ||
t.deepEqualTest( | ||
new Error('a'), | ||
{ message: 'a' }, | ||
false, | ||
false | ||
); | ||
t.end(); | ||
}); | ||
test('[[Prototypes]]', function (t) { | ||
function C() {} | ||
var instance = new C(); | ||
delete instance.constructor; | ||
t.deepEqualTest({}, instance, 'two identical objects with different [[Prototypes]]', true, true); | ||
t.test('Dates with different prototypes', { skip: !hasProto }, function (st) { | ||
var d1 = new Date(0); | ||
var d2 = new Date(0); | ||
st.deepEqualTest(d1, d2, 'two dates with the same timestamp', true, true); | ||
var newProto = { | ||
__proto__: Date.prototype | ||
}; | ||
d2.__proto__ = newProto; // eslint-disable-line no-proto | ||
st.ok(d2 instanceof Date, 'd2 is still a Date instance after tweaking [[Prototype]]'); | ||
st.deepEqualTest(d1, d2, 'two dates with the same timestamp and different [[Prototype]]', true, true); | ||
st.end(); | ||
}); | ||
t.end(); | ||
}); | ||
test('toStringTag', { skip: !hasSymbols || !Symbol.toStringTag }, function (t) { | ||
var o1 = {}; | ||
t.equal(Object.prototype.toString.call(o1), '[object Object]', 'o1: Symbol.toStringTag works'); | ||
var o2 = {}; | ||
t.equal(Object.prototype.toString.call(o2), '[object Object]', 'o2: original Symbol.toStringTag works'); | ||
t.deepEqualTest(o1, o2, 'two normal empty objects', true, true); | ||
o2[Symbol.toStringTag] = 'jifasnif'; | ||
t.equal(Object.prototype.toString.call(o2), '[object jifasnif]', 'o2: modified Symbol.toStringTag works'); | ||
t.deepEqualTest(o1, o2, 'two normal empty objects with different toStringTags', true, true); | ||
t.end(); | ||
}); | ||
test('boxed primitives', function (t) { | ||
t.deepEqualTest(Object(false), false, 'boxed and primitive `false`', true, false); | ||
t.deepEqualTest(Object(true), true, 'boxed and primitive `true`', false, false); | ||
t.deepEqualTest(Object(3), 3, 'boxed and primitive `3`', false, false); | ||
t.deepEqualTest(Object(NaN), NaN, 'boxed and primitive `NaN`', false, false); | ||
t.deepEqualTest(Object(''), '', 'boxed and primitive `""`', true, false); | ||
t.deepEqualTest(Object('str'), 'str', 'boxed and primitive `"str"`', false, false); | ||
t.test('symbol', { skip: !hasSymbols }, function (st) { | ||
var s = Symbol(''); | ||
st.deepEqualTest(Object(s), s, 'boxed and primitive `Symbol()`', false, false); | ||
st.end(); | ||
}); | ||
t.test('bigint', { skip: typeof BigInt !== 'function' }, function (st) { | ||
var hhgtg = BigInt(42); | ||
st.deepEqualTest(Object(hhgtg), hhgtg, 'boxed and primitive `BigInt(42)`', false, false); | ||
st.end(); | ||
}); | ||
t.test('`valueOf` is called for boxed primitives', function (st) { | ||
var a = Object(5); | ||
a.valueOf = function () { throw new Error('failed'); }; | ||
var b = Object(5); | ||
b.valueOf = function () { throw new Error('failed'); }; | ||
st.deepEqualTest(a, b, 'two boxed numbers with a thrower valueOf', false, false); | ||
st.end(); | ||
}); | ||
t.end(); | ||
}); | ||
test('getters', { skip: !Object.defineProperty }, function (t) { | ||
var a = {}; | ||
Object.defineProperty(a, 'a', { enumerable: true, get: function () { return 5; } }); | ||
var b = {}; | ||
Object.defineProperty(b, 'a', { enumerable: true, get: function () { return 6; } }); | ||
t.deepEqualTest(a, b, 'two objects with the same getter but producing different values', false, false); | ||
t.end(); | ||
}); | ||
var isBrokenNode = isNode && process.env.ASSERT && semver.satisfies(process.version, '<= 13.3.0'); | ||
test('fake arrays: extra keys will be tested', { skip: !hasProto || isBrokenNode }, function (t) { | ||
var a = tag({ | ||
__proto__: Array.prototype, | ||
0: 1, | ||
1: 1, | ||
2: 'broken', | ||
length: 2 | ||
}, 'Array'); | ||
if (Object.defineProperty) { | ||
Object.defineProperty(a, 'length', { | ||
enumerable: false | ||
}); | ||
} | ||
t.deepEqualTest(a, [1, 1], 'fake and real array with same contents and [[Prototype]]', false, false); | ||
var b = tag(/abc/, 'Array'); | ||
b.__proto__ = Array.prototype; // eslint-disable-line no-proto | ||
b.length = 3; | ||
if (Object.defineProperty) { | ||
Object.defineProperty(b, 'length', { | ||
enumerable: false | ||
}); | ||
} | ||
t.deepEqualTest(b, ['a', 'b', 'c'], 'regex faking as array, and array', false, false); | ||
t.end(); | ||
}); | ||
test('circular references', { skip: 'not supported until v2' }, function (t) { | ||
var b = {}; | ||
b.b = b; | ||
var c = {}; | ||
c.b = c; | ||
t.deepEqualTest( | ||
b, | ||
c, | ||
'two self-referencing objects', | ||
true, | ||
true | ||
); | ||
var d = {}; | ||
d.a = 1; | ||
d.b = d; | ||
var e = {}; | ||
e.a = 1; | ||
e.b = e.a; | ||
t.deepEqualTest( | ||
d, | ||
e, | ||
'two deeply self-referencing objects', | ||
false, | ||
false | ||
); | ||
t.end(); | ||
}); | ||
// io.js v2 is the only version where `console.log(b)` below is catchable | ||
var isNodeWhereBufferBreaks = isNode && semver.satisfies(process.version, '< 3'); | ||
var isNode06 = isNode && semver.satisfies(process.version, '<= 0.6'); // segfaults in node 0.6, it seems | ||
test('TypedArrays', { skip: !hasTypedArrays }, function (t) { | ||
t.test('Buffer faked as Uint8Array', { skip: typeof Buffer !== 'function' || !Object.create || !hasProto || isNode06 }, function (st) { | ||
var a = safeBuffer('test'); | ||
var b = tag(Object.create( | ||
a.__proto__, // eslint-disable-line no-proto | ||
assign(gOPDs(a), { | ||
length: { | ||
enumerable: false, | ||
value: 4 | ||
} | ||
}) | ||
), 'Uint8Array'); | ||
st.deepEqualTest( | ||
a, | ||
b, | ||
'Buffer and Uint8Array', | ||
true || isNodeWhereBufferBreaks, | ||
true || isNodeWhereBufferBreaks | ||
); | ||
st.end(); | ||
}); | ||
forEach(availableTypedArrays, function (name) { | ||
t.test(name + 's', function (st) { | ||
var TA = global[name]; | ||
var isBigInt = name.slice(0, 3) === 'Big'; | ||
var Z = isBigInt ? BigInt : Number; | ||
st.deepEqualTest( | ||
new TA([Z(1), Z(2), Z(3)]), | ||
new TA([Z(1), Z(2), Z(3)]), | ||
'two ' + name + 's with the same contents', | ||
true, | ||
true | ||
); | ||
st.deepEqualTest( | ||
new TA([Z(1), Z(2), Z(3)]), | ||
new TA([Z(1), Z(2), Z(4)]), | ||
'two ' + name + 's with different contents', | ||
false, | ||
false | ||
); | ||
st.end(); | ||
}); | ||
}); | ||
t.test('one TypedArray faking as another', { skip: !hasProto }, function (st) { | ||
var a = new Uint8Array(10); | ||
var b = tag(new Int8Array(10), 'Uint8Array'); | ||
b.__proto__ = Uint8Array.prototype; // eslint-disable-line no-proto | ||
defineDataProperty(b, 'length', 10); | ||
st.deepEqualTest( | ||
a, | ||
b, | ||
'Uint8Array, and Int8Array pretending to be a Uint8Array', | ||
false, | ||
false | ||
); | ||
st.end(); | ||
}); | ||
t.test('ArrayBuffers', { skip: typeof ArrayBuffer !== 'function' }, function (st) { | ||
var buffer1 = new ArrayBuffer(8); // initial value of 0's | ||
var buffer2 = new ArrayBuffer(8); // initial value of 0's | ||
var view1 = new Int8Array(buffer1); | ||
var view2 = new Int8Array(buffer2); | ||
st.deepEqualTest( | ||
view1, | ||
view2, | ||
'Int8Arrays of similar ArrayBuffers', | ||
true, | ||
true | ||
); | ||
st.deepEqualTest( | ||
buffer1, | ||
buffer2, | ||
'similar ArrayBuffers', | ||
true, | ||
true | ||
); | ||
for (var i = 0; i < view1.byteLength; i += 1) { | ||
view1[i] = 9; // change all values to 9's | ||
} | ||
st.deepEqualTest( | ||
view1, | ||
view2, | ||
'Int8Arrays of different ArrayBuffers', | ||
false, | ||
false | ||
); | ||
var isHigherThanNode010 = isNode && semver.satisfies(process.version, '> 0.10'); | ||
st.deepEqualTest( | ||
buffer1, | ||
buffer2, | ||
'different ArrayBuffers', | ||
isHigherThanNode010, | ||
isHigherThanNode010 | ||
); | ||
// node < 0.11 has a nonconfigurable own byteLength property | ||
t.test('lies about byteLength', { skip: !('byteLength' in ArrayBuffer.prototype) }, function (s2t) { | ||
var empty4 = new ArrayBuffer(4); | ||
var empty6 = new ArrayBuffer(6); | ||
Object.defineProperty(empty6, 'byteLength', { value: 4 }); | ||
s2t.deepEqualTest( | ||
empty4, | ||
empty6, | ||
'different-length ArrayBuffers, one lying', | ||
true, | ||
true | ||
); | ||
s2t.end(); | ||
}); | ||
st.end(); | ||
}); | ||
t.test('SharedArrayBuffers', { skip: typeof SharedArrayBuffer !== 'function' }, function (st) { | ||
var buffer1 = new SharedArrayBuffer(8); // initial value of 0's | ||
var buffer2 = new SharedArrayBuffer(8); // initial value of 0's | ||
var view1 = new Int8Array(buffer1); | ||
var view2 = new Int8Array(buffer2); | ||
st.deepEqualTest( | ||
view1, | ||
view2, | ||
'Int8Arrays of similar SharedArrayBuffers', | ||
true, | ||
true | ||
); | ||
st.deepEqualTest( | ||
buffer1, | ||
buffer2, | ||
'similar SharedArrayBuffers', | ||
true, | ||
true | ||
); | ||
for (var i = 0; i < view1.byteLength; i += 1) { | ||
view1[i] = 9; // change all values to 9's | ||
} | ||
st.deepEqualTest( | ||
view1, | ||
view2, | ||
'Int8Arrays of different SharedArrayBuffers', | ||
false, | ||
false | ||
); | ||
st.deepEqualTest( | ||
buffer1, | ||
buffer2, | ||
'different SharedArrayBuffers', | ||
true, | ||
true | ||
); | ||
t.test('lies about byteLength', { skip: !('byteLength' in SharedArrayBuffer.prototype) }, function (s2t) { | ||
var empty4 = new SharedArrayBuffer(4); | ||
var empty6 = new SharedArrayBuffer(6); | ||
Object.defineProperty(empty6, 'byteLength', { value: 4 }); | ||
s2t.deepEqualTest( | ||
empty4, | ||
empty6, | ||
'different-length SharedArrayBuffers, one lying', | ||
true, | ||
true | ||
); | ||
s2t.end(); | ||
}); | ||
st.end(); | ||
}); | ||
t.end(); | ||
}); |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
75315
15
1279
74
13
4
1
Updatedis-arguments@^1.1.1
Updatedis-date-object@^1.0.5
Updatedis-regex@^1.1.4
Updatedobject-is@^1.1.5