pax_global_header00006660000000000000000000000064145230234740014516gustar00rootroot0000000000000052 comment=48d3bb5b7fe3e65fd564b737c69a9411eb40bc65 node-deep-equal-2.2.3/000077500000000000000000000000001452302347400144675ustar00rootroot00000000000000node-deep-equal-2.2.3/.eslintrc000077500000000000000000000014151452302347400163170ustar00rootroot00000000000000{ "root": true, "extends": "@ljharb", "rules": { "complexity": 0, "eqeqeq": [2, "always", { "null": "ignore" }], "func-style": [2, "declaration"], "id-length": 0, "indent": [2, 2], "max-params": [2, 6], "max-statements-per-line": [2, { "max": 2 }], "new-cap": [2, { "capIsNewExceptions": ["GetIntrinsic"] }], "no-magic-numbers": [2, { "ignore": [0, 1] }], }, "globals": { "Int8Array": false, "Uint8Array": false, }, "overrides": [ { "files": "example/**", "rules": { "no-console": 0, "no-magic-numbers": 0, } }, { "files": "test/**", "rules": { "max-lines-per-function": 0, "max-params": 0, "no-magic-numbers": 0, }, }, ], } node-deep-equal-2.2.3/.github/000077500000000000000000000000001452302347400160275ustar00rootroot00000000000000node-deep-equal-2.2.3/.github/workflows/000077500000000000000000000000001452302347400200645ustar00rootroot00000000000000node-deep-equal-2.2.3/.github/workflows/node-assert.yml000066400000000000000000000032351452302347400230360ustar00rootroot00000000000000name: 'Tests: node.js `assert`' on: [pull_request, push] jobs: matrix: runs-on: ubuntu-latest outputs: requireds: ${{ steps.set-matrix.outputs.requireds }} optionals: ${{ steps.set-matrix.outputs.optionals }} steps: - uses: ljharb/actions/node/matrix@main id: set-matrix with: type: 'majors' requireds: '^12.16 || >= 13.4' optionals: '>= 8 < 12.16 || ^13.0 < 13.4' assert-required: needs: [matrix] name: 'assert: required' runs-on: ubuntu-latest strategy: fail-fast: false matrix: ${{ fromJson(needs.matrix.outputs.requireds) }} steps: - uses: actions/checkout@v2 - uses: ljharb/actions/node/install@main name: 'nvm install ${{ matrix.node-version }} && npm install' with: node-version: ${{ matrix.node-version }} - run: npm run tests-only env: ASSERT: true - uses: codecov/codecov-action@v2 assert-optional: needs: [matrix] name: 'assert: optional' runs-on: ubuntu-latest continue-on-error: true strategy: fail-fast: false matrix: ${{ fromJson(needs.matrix.outputs.optionals) }} steps: - uses: actions/checkout@v2 - uses: ljharb/actions/node/install@main name: 'nvm install ${{ matrix.node-version }} && npm install' with: node-version: ${{ matrix.node-version }} - run: npm run tests-only env: ASSERT: true - uses: codecov/codecov-action@v2 assert: name: 'node: assert' needs: [assert-required, assert-optional] runs-on: ubuntu-latest steps: - run: 'echo tests completed' node-deep-equal-2.2.3/.github/workflows/node-aught.yml000066400000000000000000000005161452302347400226440ustar00rootroot00000000000000name: 'Tests: node.js < 10' on: [pull_request, push] jobs: tests: uses: ljharb/actions/.github/workflows/node.yml@main with: range: '< 10' type: minors command: npm run tests-only node: name: 'node < 10' needs: [tests] runs-on: ubuntu-latest steps: - run: 'echo tests completed' node-deep-equal-2.2.3/.github/workflows/node-pretest.yml000066400000000000000000000002061452302347400232160ustar00rootroot00000000000000name: 'Tests: pretest/posttest' on: [pull_request, push] jobs: tests: uses: ljharb/actions/.github/workflows/pretest.yml@main node-deep-equal-2.2.3/.github/workflows/node-tens.yml000066400000000000000000000005211452302347400225010ustar00rootroot00000000000000name: 'Tests: node.js >= 10' on: [pull_request, push] jobs: tests: uses: ljharb/actions/.github/workflows/node.yml@main with: range: '>= 10' type: minors command: npm run tests-only node: name: 'node >= 10' needs: [tests] runs-on: ubuntu-latest steps: - run: 'echo tests completed' node-deep-equal-2.2.3/.github/workflows/rebase.yml000066400000000000000000000002571452302347400220540ustar00rootroot00000000000000name: Automatic Rebase on: [pull_request_target] jobs: _: uses: ljharb/actions/.github/workflows/rebase.yml@main secrets: token: ${{ secrets.GITHUB_TOKEN }} node-deep-equal-2.2.3/.github/workflows/require-allow-edits.yml000066400000000000000000000003031452302347400245010ustar00rootroot00000000000000name: Require “Allow Edits” on: [pull_request_target] jobs: _: name: "Require “Allow Edits”" runs-on: ubuntu-latest steps: - uses: ljharb/require-allow-edits@main node-deep-equal-2.2.3/.gitignore000066400000000000000000000002171452302347400164570ustar00rootroot00000000000000# gitignore node_modules # Only apps should have lockfiles npm-shrinkwrap.json package-lock.json yarn.lock coverage .nyc_output .npmignore node-deep-equal-2.2.3/.npmrc000066400000000000000000000000671452302347400156120ustar00rootroot00000000000000package-lock=false allow-same-version=true message=v%s node-deep-equal-2.2.3/.nycrc000066400000000000000000000004161452302347400156070ustar00rootroot00000000000000{ "extension": [ ".js", ".cjs", ".mjs" ], "all": true, "check-coverage": false, "reporter": ["text-summary", "text", "html", "json", "lcov"], "exclude": [ "coverage", "example", "test" ], "sourceMap": true, "instrument": true } node-deep-equal-2.2.3/CHANGELOG.md000066400000000000000000001113571452302347400163100ustar00rootroot00000000000000# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [v2.2.3](https://github.com/inspect-js/node-deep-equal/compare/v2.2.2...v2.2.3) - 2023-11-08 ### Fixed - [readme] remove performance comment and highlight robustness instead [`#76`](https://github.com/inspect-js/node-deep-equal/issues/76) [`#106`](https://github.com/inspect-js/node-deep-equal/issues/106) ### Commits - Merge tag 'v1.1.2' [`c90525f`](https://github.com/inspect-js/node-deep-equal/commit/c90525fe8380c8f6680d534eff4f189c33fb1601) - [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) - [readme] update badge URLs, fix line breaking [`1d58c6e`](https://github.com/inspect-js/node-deep-equal/commit/1d58c6ecbab5275e17735d352ac7fa4a1af40aca) - [Tests] use `Buffer.from` when available [`f0d4a42`](https://github.com/inspect-js/node-deep-equal/commit/f0d4a42fb87854e17d78cb2d6e9ec0156ea3d2f3) - [Tests] use `has-proto` [`0263fb9`](https://github.com/inspect-js/node-deep-equal/commit/0263fb9170a4e6a400c3b628cfba902ebaf59df5) - [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] add missing `engines.node` [`e1d08a8`](https://github.com/inspect-js/node-deep-equal/commit/e1d08a818fdb69e4f39b7aa23dc88092d3339c43) - [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) - [Deps] update `call-bind`, `regexp.prototype.flags`, `which-typed-array` [`540e3a1`](https://github.com/inspect-js/node-deep-equal/commit/540e3a119dcd94b30253ad380fde69d5531cf0ac) - [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) - [Dev Deps] update `object.getownpropertydescriptors`, `tape` [`21851a6`](https://github.com/inspect-js/node-deep-equal/commit/21851a62cda0b832800de3070d9fbb7216e43284) - [Dev Deps] update `semver`, `tape` [`dd440b2`](https://github.com/inspect-js/node-deep-equal/commit/dd440b2267ac8fa496b907369d3e0b73f9439e87) - [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) - [Deps] update `get-intrinsic` [`6da4b86`](https://github.com/inspect-js/node-deep-equal/commit/6da4b86e4d7ad3c01736006ca129b8e3c3f2c82c) - [Dev Deps] update `tape` [`6ada1ab`](https://github.com/inspect-js/node-deep-equal/commit/6ada1ab7f9a176b10f0117a8e10b785965c0e830) - [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) - [readme] update default branch name [`030a63f`](https://github.com/inspect-js/node-deep-equal/commit/030a63f40afa3d468ffb10437cbf5acaa677fea2) - [Deps] update `which-typed-array` [`2f0c327`](https://github.com/inspect-js/node-deep-equal/commit/2f0c327eaaed7b50649c367f88944b6dd7e9f18c) - [Tests] only use `Buffer.from` when it has a length of > 1 [`f7e5776`](https://github.com/inspect-js/node-deep-equal/commit/f7e577622d943da78c2c9cd1e070eb786cf7a68b) ## [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 ### Commits - [Tests] use shared travis-ci configs [`678cb2a`](https://github.com/inspect-js/node-deep-equal/commit/678cb2a34ef920eab563af69bdf402b9273c3e2c) - [meta] add `auto-changelog` [`569bcce`](https://github.com/inspect-js/node-deep-equal/commit/569bcce030784f7506367055122c54c6cac00ebc) - [Dev Deps] update `eslint`, `@ljharb/eslint-config`; add `safe-publish-latest` [`9dedd40`](https://github.com/inspect-js/node-deep-equal/commit/9dedd409cb74c538153287db546a14f2fa583e6f) - [Tests] add `npx aud` in `posttest` [`0b76639`](https://github.com/inspect-js/node-deep-equal/commit/0b766394504f74d002ad85e7b8244ce89bb27130) - [meta] add `funding` field [`3e519e3`](https://github.com/inspect-js/node-deep-equal/commit/3e519e36998ea82120cfe9a509dc0090a87d7063) ## [v1.1.0](https://github.com/inspect-js/node-deep-equal/compare/v1.0.1...v1.1.0) - 2019-08-27 ### Commits - [Tests] up to `node` `v12.7`, `v11.15`, `v10.16`, `v9.11`, `v8.16`, `v7.10`, `v6.17`, `4.9`; use `nvm install-latest-npm` [`ba11166`](https://github.com/inspect-js/node-deep-equal/commit/ba111664928f3a9279528dd05330b974950003b4) - [Tests] make a `tape` helper, to easily compare loose/strict, and (a,b)/(b,a) arg order [`0c25e94`](https://github.com/inspect-js/node-deep-equal/commit/0c25e9438b2d4a96e75c3c2e6fbb353ae450ed1f) - [Tests] add `npm run lint` [`8590816`](https://github.com/inspect-js/node-deep-equal/commit/8590816be6bc57a07fbc160985f5f04f11c7fa97) - test: Fails simple array tests on IE < 9 #10 [`bc37498`](https://github.com/inspect-js/node-deep-equal/commit/bc374988ee763a881ef39d8f6949838ec4df4e64) - [Tests] clean up/flesh out test cases [`3fffed9`](https://github.com/inspect-js/node-deep-equal/commit/3fffed9a7e095bbf922561fa0b18681422861af8) - [Fix] (array,arguments) now behaves the same as (arguments,array) [`a9528ff`](https://github.com/inspect-js/node-deep-equal/commit/a9528ff71561c303e722eb5ae0a3b9b2ecae4a3b) - [Refactor] move Date and RegExp tests into `objEquiv` [`5b3bf31`](https://github.com/inspect-js/node-deep-equal/commit/5b3bf315b603f00bab49e78c05c075cdc0dfd506) - [Fix] properly compare RegExp objects [`b8c179c`](https://github.com/inspect-js/node-deep-equal/commit/b8c179c5aa91c8a2f71f053e2d9e2d477780250e) - [Refactor] Use `object-keys` and `is-arguments` instead of a homegrown shim. [`3b503fb`](https://github.com/inspect-js/node-deep-equal/commit/3b503fb262c431df72a6c91cbb384be557315645) - [Fix] use `object-is` to support `NaN` and `-0` properly [`28fde4a`](https://github.com/inspect-js/node-deep-equal/commit/28fde4a411073e3131d3637248f8c25aac9329f2) - [meta] fix license text so GitHub can detect it [`7000403`](https://github.com/inspect-js/node-deep-equal/commit/700040347119ce46b3e917e800d87628af1384f9) - [Tests] add array/object tests [`558eecf`](https://github.com/inspect-js/node-deep-equal/commit/558eecf9daa815468f0bc4c9799041507b7ffa15) - [Fix] ensure Buffer + non-Buffer comparison order does not matter [`de4e75c`](https://github.com/inspect-js/node-deep-equal/commit/de4e75ce7f0621cdc09ae8cbdc82de9e4c17578e) - [Refactor] `objEquiv`: bail early if typeofs are different [`410e2d6`](https://github.com/inspect-js/node-deep-equal/commit/410e2d63730763e7e92c9b45b916f97058ab31f7) - [Tests] add tests for `Object.create(null)` [`ed266e8`](https://github.com/inspect-js/node-deep-equal/commit/ed266e8571d1efdbb4ece0a01f849cbc57461076) - [Refactor] there is no need to do further compareation when two types are not equal [`6a5efc1`](https://github.com/inspect-js/node-deep-equal/commit/6a5efc130e96398de55cf517969746c52735f34b) - Only apps should have lockfiles [`f60442f`](https://github.com/inspect-js/node-deep-equal/commit/f60442fa6fd10004366d80481ada7df668bd6adb) - [Tests] clean up redundant test [`cbbef21`](https://github.com/inspect-js/node-deep-equal/commit/cbbef21045e3b2e1ee30f6d0a83381d489df296e) - [Fix] use `is-date-object` to properly detect cross-realm Dates [`0c5b21a`](https://github.com/inspect-js/node-deep-equal/commit/0c5b21ad245d1427caefe20b2bace752cbe5e493) - [meta] Add copyright statements [`56a7746`](https://github.com/inspect-js/node-deep-equal/commit/56a774674f55bb3e0627aaec4dda90e4a06df7d6) - [Dev Deps] update `tape` [`3e9c1b9`](https://github.com/inspect-js/node-deep-equal/commit/3e9c1b903703e32bbed45fddcae815eb25822fd4) ## [v1.0.1](https://github.com/inspect-js/node-deep-equal/compare/v1.0.0...v1.0.1) - 2015-08-29 ### Fixed - Null should == undefined [`#23`](https://github.com/inspect-js/node-deep-equal/issues/23) ### Commits - Update travis.yml to modern node [`5055802`](https://github.com/inspect-js/node-deep-equal/commit/5055802274a85a3e1493fa1b7378499554c6a4dc) ## [v1.0.0](https://github.com/inspect-js/node-deep-equal/compare/v0.2.2...v1.0.0) - 2015-02-07 ## [v0.2.2](https://github.com/inspect-js/node-deep-equal/compare/v0.2.1...v0.2.2) - 2015-02-07 ### Commits - latest tape [`1d18617`](https://github.com/inspect-js/node-deep-equal/commit/1d18617608316a034c8ee6727838c9b82614f0f9) - add type check to support browsers [`3acb0d7`](https://github.com/inspect-js/node-deep-equal/commit/3acb0d7fb8915fb7f1ca97701b5761793738bad3) ## [v0.2.1](https://github.com/inspect-js/node-deep-equal/compare/v0.2.0...v0.2.1) - 2014-01-29 ### Commits - license file [`b3431d4`](https://github.com/inspect-js/node-deep-equal/commit/b3431d48e0f7c406a08d0e077f2dd9580d4561ae) ## [v0.2.0](https://github.com/inspect-js/node-deep-equal/compare/v0.1.2...v0.2.0) - 2014-01-29 ### Commits - buffer check without Buffer [`5271f39`](https://github.com/inspect-js/node-deep-equal/commit/5271f39f3ce61fecb71fa6ca28cb4a8a8b963bbd) - failing test for buffer comparison [`cc8990b`](https://github.com/inspect-js/node-deep-equal/commit/cc8990b9d84a2267d84253e21c9f7db238e961e9) ## [v0.1.2](https://github.com/inspect-js/node-deep-equal/compare/v0.1.1...v0.1.2) - 2013-12-20 ### Commits - test the arguments shim and properly factor out the arguments handling [`cf88b9c`](https://github.com/inspect-js/node-deep-equal/commit/cf88b9c2e87d6050ba1a46a82be216d0244ee428) - more coverage for the keys shim [`7a41f0e`](https://github.com/inspect-js/node-deep-equal/commit/7a41f0ec813616b0e1272c2bf463028a84d51c99) - test coverage for the non-object case [`abd3358`](https://github.com/inspect-js/node-deep-equal/commit/abd33586af0006e8492bbcdb1eb27a306359b03c) - fix the argument comparisons to properly call equal() [`0114a10`](https://github.com/inspect-js/node-deep-equal/commit/0114a10398e386ab0e073966e8525cd2ce125de4) - more code coverage for date comparisons [`41ac40e`](https://github.com/inspect-js/node-deep-equal/commit/41ac40e844b10833a75a39ea92e73bcdb1ae3cd9) - use the latest version of tape [`f8341cb`](https://github.com/inspect-js/node-deep-equal/commit/f8341cbff475ee7ee1ec651662cb5bd621c75838) - use https: for the badges [`514b332`](https://github.com/inspect-js/node-deep-equal/commit/514b332e9c2390c89c5beac8cf866c2f9a4afa9e) - 100% coverage [`e55aac7`](https://github.com/inspect-js/node-deep-equal/commit/e55aac78a6e013d6f5a10febc7009476a8f10ca5) ## [v0.1.1](https://github.com/inspect-js/node-deep-equal/compare/v0.1.0...v0.1.1) - 2013-12-20 ### Commits - Fixed arguments support for IE8- [`174d41a`](https://github.com/inspect-js/node-deep-equal/commit/174d41a5559820458648d237ebedfe78e44f7430) ## [v0.1.0](https://github.com/inspect-js/node-deep-equal/compare/v0.0.0...v0.1.0) - 2013-10-14 ### Commits - upgrade the markdown [`30e1f8f`](https://github.com/inspect-js/node-deep-equal/commit/30e1f8fe5b1fb7d5d68b156bf69bb04a7bb807a3) - opts.strict instead of a boolean arg [`58cbdb2`](https://github.com/inspect-js/node-deep-equal/commit/58cbdb2a97e623a68310833218af5ada6c97c2ce) - using testling-ci [`064af17`](https://github.com/inspect-js/node-deep-equal/commit/064af170f895fc67ec4bbf654e7de27721cf40c0) - Add optional strict parameter [`f3413b1`](https://github.com/inspect-js/node-deep-equal/commit/f3413b1d95e261f735939fbcaee65e598fe92852) - strict equality test [`281189b`](https://github.com/inspect-js/node-deep-equal/commit/281189b6962c9c57105474d01a8127da3318f555) - document opts.strict [`69fae5a`](https://github.com/inspect-js/node-deep-equal/commit/69fae5ab4b9278e28d09864c62dcfe9b4f00c1d8) - using tape [`4384db8`](https://github.com/inspect-js/node-deep-equal/commit/4384db8a9cc7af1cf79e1976d1b36e66934b2b4c) - using travis [`e508692`](https://github.com/inspect-js/node-deep-equal/commit/e5086928e1edf120d227d5e7f5e6ac4d755248a1) - deepEquals comparing nulls seems to break in ie6-8 [`b2cfeb9`](https://github.com/inspect-js/node-deep-equal/commit/b2cfeb95da6982f8bc2e676231820a3a47385db3) - performance note in the readme [`da9bfc9`](https://github.com/inspect-js/node-deep-equal/commit/da9bfc9aadfb9045bbf8157e9403de7184b404fd) - more firefoxes [`3d60ec5`](https://github.com/inspect-js/node-deep-equal/commit/3d60ec58d6fe269c13c5be04b749f01972aa5b1c) ## v0.0.0 - 2012-02-10 ### Commits - implementation with an example [`2dd56f9`](https://github.com/inspect-js/node-deep-equal/commit/2dd56f9e6d42e841c74289c2e2d489047d077622) - readme [`4a44f99`](https://github.com/inspect-js/node-deep-equal/commit/4a44f99bea3277e32d9842d9d49ac21f316ac74d) - and a test [`357ccd3`](https://github.com/inspect-js/node-deep-equal/commit/357ccd37d23ba7814c8fe284d36d6e86a39b7526) - actually just MIT [`3d348c8`](https://github.com/inspect-js/node-deep-equal/commit/3d348c88fc92ce1d69a3fedbb2aa8cb6ea1480f7) node-deep-equal-2.2.3/LICENSE000066400000000000000000000021641452302347400154770ustar00rootroot00000000000000MIT License Copyright (c) 2012, 2013, 2014 James Halliday , 2009 Thomas Robinson <280north.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. node-deep-equal-2.2.3/assert.js000066400000000000000000000000631452302347400163250ustar00rootroot00000000000000'use strict'; module.exports = require('assert'); node-deep-equal-2.2.3/example/000077500000000000000000000000001452302347400161225ustar00rootroot00000000000000node-deep-equal-2.2.3/example/cmp.js000066400000000000000000000002661452302347400172430ustar00rootroot00000000000000'use strict'; var equal = require('../'); console.dir([ equal( { a: [2, 3], b: [4] }, { a: [2, 3], b: [4] } ), equal( { x: 5, y: [6] }, { x: 5, y: 6 } ) ]); node-deep-equal-2.2.3/index.js000066400000000000000000000320271452302347400161400ustar00rootroot00000000000000'use strict'; var assign = require('object.assign'); var callBound = require('call-bind/callBound'); var flags = require('regexp.prototype.flags'); var GetIntrinsic = require('get-intrinsic'); var getIterator = require('es-get-iterator'); var getSideChannel = require('side-channel'); var is = require('object-is'); var isArguments = require('is-arguments'); var isArray = require('isarray'); var isArrayBuffer = require('is-array-buffer'); var isDate = require('is-date-object'); var isRegex = require('is-regex'); var isSharedArrayBuffer = require('is-shared-array-buffer'); var objectKeys = require('object-keys'); var whichBoxedPrimitive = require('which-boxed-primitive'); var whichCollection = require('which-collection'); var whichTypedArray = require('which-typed-array'); var byteLength = require('array-buffer-byte-length'); var sabByteLength = callBound('SharedArrayBuffer.prototype.byteLength', true); var $getTime = callBound('Date.prototype.getTime'); var gPO = Object.getPrototypeOf; var $objToString = callBound('Object.prototype.toString'); var $Set = GetIntrinsic('%Set%', true); var $mapHas = callBound('Map.prototype.has', true); var $mapGet = callBound('Map.prototype.get', true); var $mapSize = callBound('Map.prototype.size', true); var $setAdd = callBound('Set.prototype.add', true); var $setDelete = callBound('Set.prototype.delete', true); var $setHas = callBound('Set.prototype.has', true); var $setSize = callBound('Set.prototype.size', true); // taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L401-L414 function setHasEqualElement(set, val1, opts, channel) { var i = getIterator(set); var result; while ((result = i.next()) && !result.done) { if (internalDeepEqual(val1, result.value, opts, channel)) { // eslint-disable-line no-use-before-define // Remove the matching element to make sure we do not check that again. $setDelete(set, result.value); return true; } } return false; } // taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L416-L439 function findLooseMatchingPrimitives(prim) { if (typeof prim === 'undefined') { return null; } if (typeof prim === 'object') { // Only pass in null as object! return void 0; } if (typeof prim === 'symbol') { return false; } if (typeof prim === 'string' || typeof prim === 'number') { // Loose equal entries exist only if the string is possible to convert to a regular number and not NaN. return +prim === +prim; // eslint-disable-line no-implicit-coercion } return true; } // taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L449-L460 function mapMightHaveLoosePrim(a, b, prim, item, opts, channel) { var altValue = findLooseMatchingPrimitives(prim); if (altValue != null) { return altValue; } var curB = $mapGet(b, altValue); var looseOpts = assign({}, opts, { strict: false }); if ( (typeof curB === 'undefined' && !$mapHas(b, altValue)) // eslint-disable-next-line no-use-before-define || !internalDeepEqual(item, curB, looseOpts, channel) ) { return false; } // eslint-disable-next-line no-use-before-define return !$mapHas(a, altValue) && internalDeepEqual(item, curB, looseOpts, channel); } // taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L441-L447 function setMightHaveLoosePrim(a, b, prim) { var altValue = findLooseMatchingPrimitives(prim); if (altValue != null) { return altValue; } return $setHas(b, altValue) && !$setHas(a, altValue); } // taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L518-L533 function mapHasEqualEntry(set, map, key1, item1, opts, channel) { var i = getIterator(set); var result; var key2; while ((result = i.next()) && !result.done) { key2 = result.value; if ( // eslint-disable-next-line no-use-before-define internalDeepEqual(key1, key2, opts, channel) // eslint-disable-next-line no-use-before-define && internalDeepEqual(item1, $mapGet(map, key2), opts, channel) ) { $setDelete(set, key2); return true; } } return false; } function internalDeepEqual(actual, expected, options, channel) { var opts = options || {}; // 7.1. All identical values are equivalent, as determined by ===. if (opts.strict ? is(actual, expected) : actual === expected) { return true; } var actualBoxed = whichBoxedPrimitive(actual); var expectedBoxed = whichBoxedPrimitive(expected); if (actualBoxed !== expectedBoxed) { return false; } // 7.3. Other pairs that do not both pass typeof value == 'object', equivalence is determined by ==. if (!actual || !expected || (typeof actual !== 'object' && typeof expected !== 'object')) { return opts.strict ? is(actual, expected) : actual == expected; // eslint-disable-line eqeqeq } /* * 7.4. For all other Object pairs, including Array objects, equivalence is * determined by having the same number of owned properties (as verified * with Object.prototype.hasOwnProperty.call), the same set of keys * (although not necessarily the same order), equivalent values for every * corresponding key, and an identical 'prototype' property. Note: this * accounts for both named and indexed properties on Arrays. */ // see https://github.com/nodejs/node/commit/d3aafd02efd3a403d646a3044adcf14e63a88d32 for memos/channel inspiration var hasActual = channel.has(actual); var hasExpected = channel.has(expected); var sentinel; if (hasActual && hasExpected) { if (channel.get(actual) === channel.get(expected)) { return true; } } else { sentinel = {}; } if (!hasActual) { channel.set(actual, sentinel); } if (!hasExpected) { channel.set(expected, sentinel); } // eslint-disable-next-line no-use-before-define return objEquiv(actual, expected, opts, channel); } function isBuffer(x) { if (!x || typeof x !== 'object' || typeof x.length !== 'number') { return false; } if (typeof x.copy !== 'function' || typeof x.slice !== 'function') { return false; } if (x.length > 0 && typeof x[0] !== 'number') { return false; } return !!(x.constructor && x.constructor.isBuffer && x.constructor.isBuffer(x)); } function setEquiv(a, b, opts, channel) { if ($setSize(a) !== $setSize(b)) { return false; } var iA = getIterator(a); var iB = getIterator(b); var resultA; var resultB; var set; while ((resultA = iA.next()) && !resultA.done) { if (resultA.value && typeof resultA.value === 'object') { if (!set) { set = new $Set(); } $setAdd(set, resultA.value); } else if (!$setHas(b, resultA.value)) { if (opts.strict) { return false; } if (!setMightHaveLoosePrim(a, b, resultA.value)) { return false; } if (!set) { set = new $Set(); } $setAdd(set, resultA.value); } } if (set) { while ((resultB = iB.next()) && !resultB.done) { // We have to check if a primitive value is already matching and only if it's not, go hunting for it. if (resultB.value && typeof resultB.value === 'object') { if (!setHasEqualElement(set, resultB.value, opts.strict, channel)) { return false; } } else if ( !opts.strict && !$setHas(a, resultB.value) && !setHasEqualElement(set, resultB.value, opts.strict, channel) ) { return false; } } return $setSize(set) === 0; } return true; } function mapEquiv(a, b, opts, channel) { if ($mapSize(a) !== $mapSize(b)) { return false; } var iA = getIterator(a); var iB = getIterator(b); var resultA; var resultB; var set; var key; var item1; var item2; while ((resultA = iA.next()) && !resultA.done) { key = resultA.value[0]; item1 = resultA.value[1]; if (key && typeof key === 'object') { if (!set) { set = new $Set(); } $setAdd(set, key); } else { item2 = $mapGet(b, key); if ((typeof item2 === 'undefined' && !$mapHas(b, key)) || !internalDeepEqual(item1, item2, opts, channel)) { if (opts.strict) { return false; } if (!mapMightHaveLoosePrim(a, b, key, item1, opts, channel)) { return false; } if (!set) { set = new $Set(); } $setAdd(set, key); } } } if (set) { while ((resultB = iB.next()) && !resultB.done) { key = resultB.value[0]; item2 = resultB.value[1]; if (key && typeof key === 'object') { if (!mapHasEqualEntry(set, a, key, item2, opts, channel)) { return false; } } else if ( !opts.strict && (!a.has(key) || !internalDeepEqual($mapGet(a, key), item2, opts, channel)) && !mapHasEqualEntry(set, a, key, item2, assign({}, opts, { strict: false }), channel) ) { return false; } } return $setSize(set) === 0; } return true; } function objEquiv(a, b, opts, channel) { /* eslint max-statements: [2, 100], max-lines-per-function: [2, 120], max-depth: [2, 5], max-lines: [2, 400] */ var i, key; if (typeof a !== typeof b) { return false; } if (a == null || b == null) { return false; } if ($objToString(a) !== $objToString(b)) { return false; } if (isArguments(a) !== isArguments(b)) { return false; } var aIsArray = isArray(a); var bIsArray = isArray(b); if (aIsArray !== bIsArray) { return false; } // TODO: replace when a cross-realm brand check is available var aIsError = a instanceof Error; var bIsError = b instanceof Error; if (aIsError !== bIsError) { return false; } if (aIsError || bIsError) { if (a.name !== b.name || a.message !== b.message) { return false; } } var aIsRegex = isRegex(a); var bIsRegex = isRegex(b); if (aIsRegex !== bIsRegex) { return false; } if ((aIsRegex || bIsRegex) && (a.source !== b.source || flags(a) !== flags(b))) { return false; } var aIsDate = isDate(a); var bIsDate = isDate(b); if (aIsDate !== bIsDate) { return false; } if (aIsDate || bIsDate) { // && would work too, because both are true or both false here if ($getTime(a) !== $getTime(b)) { return false; } } if (opts.strict && gPO && gPO(a) !== gPO(b)) { return false; } var aWhich = whichTypedArray(a); var bWhich = whichTypedArray(b); if (aWhich !== bWhich) { return false; } if (aWhich || bWhich) { // && would work too, because both are true or both false here if (a.length !== b.length) { return false; } for (i = 0; i < a.length; i++) { if (a[i] !== b[i]) { return false; } } return true; } var aIsBuffer = isBuffer(a); var bIsBuffer = isBuffer(b); if (aIsBuffer !== bIsBuffer) { return false; } if (aIsBuffer || bIsBuffer) { // && would work too, because both are true or both false here if (a.length !== b.length) { return false; } for (i = 0; i < a.length; i++) { if (a[i] !== b[i]) { return false; } } return true; } var aIsArrayBuffer = isArrayBuffer(a); var bIsArrayBuffer = isArrayBuffer(b); if (aIsArrayBuffer !== bIsArrayBuffer) { return false; } if (aIsArrayBuffer || bIsArrayBuffer) { // && would work too, because both are true or both false here if (byteLength(a) !== byteLength(b)) { return false; } return typeof Uint8Array === 'function' && internalDeepEqual(new Uint8Array(a), new Uint8Array(b), opts, channel); } var aIsSAB = isSharedArrayBuffer(a); var bIsSAB = isSharedArrayBuffer(b); if (aIsSAB !== bIsSAB) { return false; } if (aIsSAB || bIsSAB) { // && would work too, because both are true or both false here if (sabByteLength(a) !== sabByteLength(b)) { return false; } return typeof Uint8Array === 'function' && internalDeepEqual(new Uint8Array(a), new Uint8Array(b), opts, channel); } if (typeof a !== typeof b) { return false; } var ka = objectKeys(a); var kb = objectKeys(b); // having the same number of owned properties (keys incorporates hasOwnProperty) if (ka.length !== kb.length) { return false; } // the same set of keys (although not necessarily the same order), ka.sort(); kb.sort(); // ~~~cheap key test for (i = ka.length - 1; i >= 0; i--) { if (ka[i] != kb[i]) { return false; } // eslint-disable-line eqeqeq } // equivalent values for every corresponding key, and ~~~possibly expensive deep test for (i = ka.length - 1; i >= 0; i--) { key = ka[i]; if (!internalDeepEqual(a[key], b[key], opts, channel)) { return false; } } var aCollection = whichCollection(a); var bCollection = whichCollection(b); if (aCollection !== bCollection) { return false; } if (aCollection === 'Set' || bCollection === 'Set') { // aCollection === bCollection return setEquiv(a, b, opts, channel); } if (aCollection === 'Map') { // aCollection === bCollection return mapEquiv(a, b, opts, channel); } return true; } module.exports = function deepEqual(a, b, opts) { return internalDeepEqual(a, b, opts, getSideChannel()); }; node-deep-equal-2.2.3/package.json000077500000000000000000000063271452302347400167700ustar00rootroot00000000000000{ "name": "deep-equal", "version": "2.2.3", "description": "node's assert.deepEqual algorithm", "main": "index.js", "exports": { ".": [ { "default": "./index.js" }, "./index.js" ], "./package": "./package.json", "./package.json": "./package.json" }, "directories": { "lib": ".", "example": "example", "test": "test" }, "scripts": { "prepack": "npmignore --auto --commentLines=autogenerated", "prepublish": "not-in-publish || npm run prepublishOnly", "prepublishOnly": "safe-publish-latest", "pretest": "npm run lint", "lint": "eslint --ext=js,mjs .", "tests-only": "nyc tape 'test/**/*.js'", "test": "npm run tests-only", "posttest": "aud --production", "version": "auto-changelog && git add CHANGELOG.md", "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": { "array-buffer-byte-length": "^1.0.0", "call-bind": "^1.0.5", "es-get-iterator": "^1.1.3", "get-intrinsic": "^1.2.2", "is-arguments": "^1.1.1", "is-array-buffer": "^3.0.2", "is-date-object": "^1.0.5", "is-regex": "^1.1.4", "is-shared-array-buffer": "^1.0.2", "isarray": "^2.0.5", "object-is": "^1.1.5", "object-keys": "^1.1.1", "object.assign": "^4.1.4", "regexp.prototype.flags": "^1.5.1", "side-channel": "^1.0.4", "which-boxed-primitive": "^1.0.2", "which-collection": "^1.0.1", "which-typed-array": "^1.1.13" }, "devDependencies": { "@ljharb/eslint-config": "^21.1.0", "aud": "^2.0.3", "auto-changelog": "^2.4.0", "available-typed-arrays": "^1.0.5", "eslint": "=8.8.0", "for-each": "^0.3.3", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", "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/inspect-js/node-deep-equal.git" }, "keywords": [ "equality", "equal", "compare" ], "author": { "name": "James Halliday", "email": "mail@substack.net", "url": "http://substack.net" }, "contributors": [ "James Halliday (https://substack.net)", "Jordan Harband " ], "funding": { "url": "https://github.com/sponsors/ljharb" }, "license": "MIT", "engines": { "node": ">= 0.4" }, "testling": { "files": "test/*.js", "browsers": { "ie": [ 6, 7, 8, 9 ], "ff": [ 3.5, 10, 15 ], "chrome": [ 10, 22 ], "safari": [ 5.1 ], "opera": [ 12 ] } }, "auto-changelog": { "output": "CHANGELOG.md", "template": "keepachangelog", "unreleased": false, "commitLimit": false, "backfillLimit": false, "hideCredit": true }, "browser": { "assert.js": false }, "publishConfig": { "ignore": [ ".github/workflows" ] } } node-deep-equal-2.2.3/readme.markdown000066400000000000000000000044401452302347400174720ustar00rootroot00000000000000# deep-equal [![Version Badge][npm-version-svg]][package-url] Node's `assert.deepEqual() algorithm` as a standalone module, that also works in browser environments. It mirrors the robustness of node's own `assert.deepEqual` and is robust against later builtin modification. [![github actions][actions-image]][actions-url] [![coverage][codecov-image]][codecov-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] [![npm badge][npm-badge-png]][package-url] # example ``` js var equal = require('deep-equal'); console.dir([ equal( { a : [ 2, 3 ], b : [ 4 ] }, { a : [ 2, 3 ], b : [ 4 ] } ), equal( { x : 5, y : [6] }, { x : 5, y : 6 } ) ]); ``` # methods ``` js var deepEqual = require('deep-equal') ``` ## deepEqual(a, b, opts) Compare objects `a` and `b`, returning whether they are equal according to a recursive equality algorithm. If `opts.strict` is `true`, use strict equality (`===`) to compare leaf nodes. The default is to use coercive equality (`==`) because that's how `assert.deepEqual()` works by default. # install With [npm](https://npmjs.org) do: ``` npm install deep-equal ``` # test With [npm](https://npmjs.org) do: ``` npm test ``` [package-url]: https://npmjs.org/package/deep-equal [npm-version-svg]: https://versionbadg.es/inspect-js/deep-equal.svg [deps-svg]: https://david-dm.org/inspect-js/node-deep-equal.svg [deps-url]: https://david-dm.org/inspect-js/node-deep-equal [dev-deps-svg]: https://david-dm.org/inspect-js/node-deep-equal/dev-status.svg [dev-deps-url]: https://david-dm.org/inspect-js/node-deep-equal#info=devDependencies [npm-badge-png]: https://nodei.co/npm/deep-equal.png?downloads=true&stars=true [license-image]: https://img.shields.io/npm/l/deep-equal.svg [license-url]: LICENSE [downloads-image]: https://img.shields.io/npm/dm/deep-equal.svg [downloads-url]: https://npm-stat.com/charts.html?package=deep-equal [codecov-image]: https://codecov.io/gh/inspect-js/node-deep-equal/branch/main/graphs/badge.svg [codecov-url]: https://app.codecov.io/gh/inspect-js/node-deep-equal/ [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/node-deep-equal [actions-url]: https://github.com/inspect-js/node-deep-equal/actions node-deep-equal-2.2.3/test/000077500000000000000000000000001452302347400154465ustar00rootroot00000000000000node-deep-equal-2.2.3/test/_tape.js000066400000000000000000000024531452302347400171000ustar00rootroot00000000000000'use strict'; var Test = require('tape/lib/test'); var is = require('object-is'); 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 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); t.equal(actualReverse, !!isEqual, msg + suffix + ' (reversed)'); } } function deepEqualTest(t, a, b, msg, isEqual, isStrictEqual, skipReversed) { equalReversed(t, a, b, isEqual, msg, false, skipReversed); equalReversed(t, a, b, isStrictEqual, 'strict: ' + msg, true, skipReversed); } Test.prototype.deepEqualTest = function (a, b, message, isEqual, isStrictEqual, skipReversed) { return deepEqualTest(this, a, b, message, !!isEqual, !!isStrictEqual, skipReversed); }; node-deep-equal-2.2.3/test/cmp.js000066400000000000000000000720551452302347400165740ustar00rootroot00000000000000'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 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) { t.deepEqualTest( { a: [2, 3], b: [4] }, { a: [2, 3], b: [4] }, 'two equal objects', true, true, false ); 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', false, false ); t.deepEqualTest( new Map([['a', 1]]), new Map([['b', 1]]), 'two inequal Maps', false, false ); 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, false ); 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, false ); t.deepEqualTest( new Map([[undefined, 3]]), new Map([[null, 3]]), 'nullish keys, loosely equal, strictly inequal', true, false ); 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', false, false ); t.deepEqualTest( new Map([[{}, null], [false, 3]]), new Map([[{}, null], [true, 2]]), 'two inequal maps, same size, primitive key, start with object key', false, false ); t.deepEqualTest( new Map([[false, 3], [{}, null]]), new Map([[true, 2], [{}, null]]), 'two inequal maps, same size, primitive key, start with primitive key', false, false ); t.deepEqualTest( new Map([[undefined, null], ['+000', 2]]), new Map([[null, undefined], [false, '2']]), 'primitive comparisons', true, false ); 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', false, false ); 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', false, false ); t.deepEqualTest( new Set([{ a: 1 }, 2]), new Set(['2', { a: '1' }]), 'two loosely equal, strictly inequal Sets', true, false ); t.deepEqualTest( new Set([{ a: 1 }, 2]), new Set(['2', { a: 2 }]), 'two inequal Sets', false, false ); t.deepEqualTest( new Set([null, '', 1, 5, 2, false]), new Set([undefined, 0, '5', true, '2', '-000']), 'more primitive comparisons', true, false ); 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', false, false ); 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', false, false ); 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) { t.deepEqualTest( { x: 5, y: [6] }, { x: 5, y: 6 }, 'two inequal objects are', false, false ); t.end(); }); test('nested nulls', function (t) { t.deepEqualTest( [null, null, null], [null, null, null], 'same-length arrays of nulls', true, true, true ); t.end(); }); test('objects with strings vs numbers', function (t) { t.deepEqualTest( [{ a: 3 }, { b: 4 }], [{ a: '3' }, { b: '4' }], 'objects with equivalent string/number values', true, false ); t.end(); }); test('non-objects', function (t) { t.deepEqualTest(3, 3, 'same numbers', true, true, true); t.deepEqualTest('beep', 'beep', 'same strings', true, true, true); t.deepEqualTest('3', 3, 'numeric string and number', true, false); t.deepEqualTest('3', [3], 'numeric string and array containing number', false, false); t.deepEqualTest(3, [3], 'number and array containing number', false, false); t.end(); }); test('infinities', function (t) { t.deepEqualTest(Infinity, Infinity, '∞ and ∞', true, true, true); t.deepEqualTest(-Infinity, -Infinity, '-∞ and -∞', true, true, true); t.deepEqualTest(Infinity, -Infinity, '∞ and -∞', false, false); t.end(); }); test('arguments class', function (t) { function getArgs() { return arguments; } t.deepEqualTest( getArgs(1, 2, 3), getArgs(1, 2, 3), 'equivalent arguments objects are equal', true, true, true ); t.deepEqualTest( getArgs(1, 2, 3), [1, 2, 3], 'array and arguments with same contents', false, false ); 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) { var d0 = new Date(1387585278000); var d1 = new Date('Fri Dec 20 2013 16:21:18 GMT-0800 (PST)'); 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', false, false); 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', false, false ); 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', false, false ); t.deepEqualTest( new Date('2000'), new Date('2001'), 'two inequal Dates', false, false ); t.end(); }); test('buffers', { skip: typeof Buffer !== 'function' }, function (t) { /* eslint no-buffer-constructor: 1, new-cap: 1 */ t.deepEqualTest( safeBuffer('xyz'), safeBuffer('xyz'), 'buffers with same contents are equal', true, true ); t.deepEqualTest( 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', false, false ); var emptyBuffer = safeBuffer(''); t.deepEqualTest( emptyBuffer, [], 'empty buffer and empty array', false, false ); 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) { t.deepEqualTest( true, [], 'true and an empty array', false, false ); t.deepEqualTest( false, [], 'false and an empty array', false, false ); t.end(); }); test('arrays initiated', function (t) { var a0 = [ 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.deepEqualTest( a0, a1, 'arrays with equal contents are equal', true, true, true ); t.end(); }); test('arrays assigned', function (t) { var a0 = [ undefined, null, -1, 0, 1, false, true, undefined, '', 'abc', null, undefined ]; var a1 = []; a1[0] = undefined; a1[1] = null; a1[2] = -1; a1[3] = 0; a1[4] = 1; a1[5] = false; a1[6] = true; a1[7] = undefined; a1[8] = ''; a1[9] = 'abc'; a1[10] = null; a1[11] = undefined; a1.length = 12; t.deepEqualTest(a0, a1, 'a literal array and an assigned array', true, true); t.end(); }); test('arrays push', function (t) { var a0 = [ undefined, null, -1, 0, 1, false, true, undefined, '', 'abc', null, undefined ], a1 = []; a1.push(undefined); a1.push(null); a1.push(-1); a1.push(0); a1.push(1); a1.push(false); a1.push(true); a1.push(undefined); a1.push(''); a1.push('abc'); a1.push(null); a1.push(undefined); a1.length = 12; t.deepEqualTest(a0, a1, 'a literal array and a pushed array', true, true); t.end(); }); test('null == undefined', function (t) { t.deepEqualTest(null, undefined, 'null and undefined', true, false); t.deepEqualTest([null], [undefined], '[null] and [undefined]', true, false); 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.deepEqualTest( NaN, NaN, 'two NaNs', isNode14, true ); t.deepEqualTest( { a: NaN }, { a: NaN }, 'two equiv objects with a NaN value', isNode14, true ); t.deepEqualTest(NaN, 1, 'NaN and 1', false, false); t.end(); }); test('zeroes', function (t) { t.deepEqualTest(0, -0, '0 and -0', true, false); t.deepEqualTest({ a: 0 }, { a: -0 }, 'two objects with a same-keyed 0/-0 value', true, false); t.end(); }); test('Object.create', { skip: !Object.create }, function (t) { var a = { a: 'A' }; var b = Object.create(a); b.b = 'B'; var c = Object.create(a); c.b = 'C'; t.deepEqualTest( b, c, 'two objects with the same [[Prototype]] but a different own property', false, false ); t.end(); }); test('Object.create(null)', { skip: !Object.create }, function (t) { t.deepEqualTest( Object.create(null), Object.create(null), 'two empty null objects', true, true, true ); t.deepEqualTest( Object.create(null, { a: { value: 'b' } }), Object.create(null, { a: { value: 'b' } }), 'two null objects with the same property pair', true, true, true ); t.end(); }); test('regexes vs dates', function (t) { var d = new Date(1387585278000); var r = /abc/; t.deepEqualTest(d, r, 'Date and RegExp', false, false); t.end(); }); test('regexen', function (t) { t.deepEqualTest(/abc/, /xyz/, 'two different regexes', false, false); t.deepEqualTest(/abc/, /abc/, 'two abc regexes', true, true, false); t.deepEqualTest(/xyz/, /xyz/, 'two xyz regexes', true, true, false); 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', false, false ); 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', true, false ); t.end(); }); test('arrays and objects', function (t) { t.deepEqualTest([], {}, 'empty array and empty object', false, false); t.deepEqualTest([], { length: 0 }, 'empty array and empty arraylike object', false, false); t.deepEqualTest([1], { 0: 1 }, 'array and similar object', false, false); t.end(); }); test('functions', function (t) { function f() {} 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', false, false); t.deepEqualTest(new Error('xyz'), new Error('zyx'), 'two errors of the same type with a different message', false, false); 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', false, false ); 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, false); 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, false); 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', false, false); t.end(); }); test('boxed primitives', function (t) { t.deepEqualTest(Object(false), false, 'boxed and primitive `false`', false, 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 `""`', false, 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', 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', isNodeWhereBufferBreaks, 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 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 ); st.deepEqualTest( buffer1, buffer2, 'different ArrayBuffers', false, false ); // 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', false, false ); 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', false, false ); 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', false, false ); s2t.end(); }); st.end(); }); t.end(); });