パッケージの詳細

deep-equal

inspect-js85.7mMIT2.2.3

node's assert.deepEqual algorithm

equality, equal, compare

readme

deep-equal Version Badge

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 coverage License Downloads

npm badge

example

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

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 do:

npm install deep-equal

test

With npm do:

npm test

更新履歴

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v2.2.3 - 2023-11-08

Fixed

  • [readme] remove performance comment and highlight robustness instead #76 #106

Commits

  • Merge tag 'v1.1.2' c90525f
  • [Tests] port tests from main; only diff should be true/falses e02cadb
  • [Dev Deps] update @ljharb/eslint-config, auto-changelog, aud, eslint, set-publish-latest, tape 11bd45b
  • [Tests] update .github from default branch 58885d3
  • [readme] update readme from default branch b0bca9a
  • [Tests] add nyc for coverage e25bc37
  • [readme] update badge URLs, fix line breaking 1d58c6e
  • [Tests] use Buffer.from when available f0d4a42
  • [Tests] use has-proto 0263fb9
  • [Deps] update is-arguments, is-date-object, is-regex, object-is, regexp.prototype.flags 80c15ca
  • [meta] add missing engines.node e1d08a8
  • [meta] use npmignore to autogenerate an npmignore file e0770e5
  • [Deps] update is-date-object, is-regex, object-is, regexp.prototype.flags e4fb8c6
  • [Tests] handle ported test failures in iojs v2 3798ff4
  • [Deps] update call-bind, regexp.prototype.flags, which-typed-array 540e3a1
  • [Dev Deps] update eslint, @ljharb/eslint-config, tape 0f8ca75
  • [Tests] handle some additional test differences in node <= 0.10 197a220
  • [Dev Deps] update object.getownpropertydescriptors, tape 21851a6
  • [Dev Deps] update semver, tape dd440b2
  • [meta] add missing engines.node e158993
  • [meta] update .gitignore from default branch 6ee186b
  • [Deps] update get-intrinsic 6da4b86
  • [Dev Deps] update tape 6ada1ab
  • [Dev Deps] update tape 270d34b
  • [meta] fix URLs a269c18
  • [readme] update default branch name 030a63f
  • [Deps] update which-typed-array 2f0c327
  • [Tests] only use Buffer.from when it has a length of > 1 f7e5776

v2.2.2 - 2023-07-10

Commits

  • [Fix] avoid an infinite loop in node 0.8 with Typed Arrays f247282
  • [Dev Deps] update @ljharb/eslint-config, aud, tape fa25583
  • [Deps] update get-intrinsic 3638470

v2.2.1 - 2023-04-27

Commits

  • [Tests] add passing tests covering object key ordering 51c9ff6
  • [Refactor] use array-buffer-byte-length f47822c
  • [Deps] update is-array-buffer, regexp.prototype.flags 160d851
  • [Deps] update es-get-iterator, get-intrinsic 2e08e95
  • [Dev Deps] update object.getownpropertydescriptors 63e9ab7
  • [Dev Deps] update tape c8db964

v2.2.0 - 2023-01-05

Commits

  • [New] add support for SharedArrayBuffer 0ef51c7
  • [Refactor] use is-array-buffer package 0360ee1
  • [Fix] whichTypedArray can return false in both cases df3e3c4
  • [Dev Deps] update aud, object.getownpropertydescriptors 6d62ea4
  • [Dev Deps] update @ljharb/eslint-config 15aab59
  • [Deps] update which-typed-array 8dfce27
  • [eslint] remove .eslintignore af46773

v2.1.0 - 2022-11-02

Fixed

  • [New] add support for ArrayBuffer #94

Commits

  • [actions] reuse common workflows 12de287
  • [actions] use node/install instead of node/run; use codecov action ec248b9
  • [Tests] run assert tests on a dynamic matrix 695aebd
  • [readme] add badges 492e159
  • [Test] ArrayBuffers in node < 0.12 have a nonconfigurable own byteLength property 40f4b87
  • [meta] use npmignore to autogenerate an npmignore file 2627269
  • [Dev Deps] update eslint, @ljharb/eslint-config, safe-publish-latest, tape 7a05bb7
  • [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
  • [actions] update codecov uploader b1b0552
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, has-symbols, object.getownpropertydescriptors, tape 9a1ccf5
  • [meta] do not publish github action workflow files 2d63384
  • [actions] update rebase action to use reusable workflow 69d21f5
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, has-symbols, object.getownpropertydescriptors, tape 297aae8
  • [Tests] add tests for regexes with the same source but different flags 29c8a0d
  • [Dev Deps] update eslint, @ljharb/eslint-config 9e64ec9
  • [Deps] update is-arguments, is-date-object, is-regex, which-typed-array edfb752
  • [Dev Deps] update eslint, @ljharb/eslint-config, auto-changelog, tape 7b5f7a3
  • [Dev Deps] update eslint, @ljharb/eslint-config, has-typed-arrays, tape e328a23
  • [Deps] update get-intrinsic, regexp.prototype.flags, which-typed-array 29123a7
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud b7039ef
  • [Dev Deps] update aud, tape 9d0b2e0
  • [actions] update workflows a5f5a7e
  • [Deps] update get-intrinsic, object.assign 02025e2
  • [Test] node < 4 lacks ArrayBuffer.prototype.fill bb65b07
  • [Deps] update is-date-object, is-regex a463ed2
  • [Deps] update get-intrinsic, object-is 2a33cce
  • [actions] update workflows d905278
  • [meta] use prepublishOnly script for npm 7+ 7b66184
  • [Dev Deps] update object.getownpropertydescriptors d970dbc

v2.0.5 - 2020-12-01

Commits

  • [Tests] migrate tests to Github Actions 4051a18
  • [meta] add Automatic Rebase and Require Allow Edits workflows 6682b15
  • [Deps] use call-bind and get-intrinsic instead of es-abstract; update es-get-iterator, object-is, object.assign a1d6d93
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, object.getownpropertydescriptors b142f4b

v2.0.4 - 2020-10-01

Fixed

  • [meta] fix incorrect ./package.json exports entry #89

Commits

  • [Dev Deps] update eslint, @ljharb/eslint-config, auto-changelog d6bfee3
  • [Tests] account for node 14+ making two NaNs loosely deep equal 9367954
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, tape 86a159b
  • [Deps] update es-abstract, object-is, object.assign e87979d
  • [Deps] update es-abstract, is-regex d0cacca
  • [Dev Deps] update eslint, @ljharb/eslint-config, tape 375a9e1
  • [Dev Deps] update eslint, auto-changelog e562d4f
  • [Deps] update side-channel f092342

v2.0.3 - 2020-04-23

Commits

  • [Deps] update object-is, which-typed-array c232374
  • [Dev Deps] update auto-changelog; add aud c80a91d
  • [Dev Deps] update auto-changelog 295d195
  • [Dev Deps] update aud 1134cc2
  • [Deps] Fix classification of object.assign 32695dd

v2.0.2 - 2020-04-01

Commits

  • [Fix] properly pass strict option through internals 4e2919d
  • [Tests] add more coverage a3d8677
  • [Tests] add coverage reporting 3174e33
  • [Refactor] add strict pragma; remove unused try/catch c1d173e
  • [Fix] the prototype property is not special on non-functions 1c3cc25
  • [Deps] update es-abstract, es-get-iterator, is-date-object, is-regex, object-is, regexp.prototype.flags, side-channel 7787bdc
  • [Deps] update es-abstract, es-get-iterator, which-collection 87624cf
  • [Fix] robustly distinguish Typed Arrays 7ccb2b0
  • [Dev Deps] update @ljharb/eslint-config, tape c1814a1
  • [Dev Deps] update @ljharb/eslint-config, object.getownpropertydescriptors, tape 7a0d819
  • [Dev Deps] update auto-changelog, tape f248756
  • [Tests] fix tag helper, from bb50ea2e6d7906cd58683fdc7d327660e71612f4 469f008
  • [Dev Deps] update eslint, tape 6537dce
  • [Fix] make isBuffer check slightly more robust c21e14d
  • [meta] disable greenkeeper updates for semver 724f051
  • [Deps] update es-abstract 942ad86
  • [Deps] update es-abstract 8724052

v2.0.1 - 2019-12-08

Fixed

  • [Fix] Map and Set comparison: keys are loosely compared also #75

Commits

  • [Fix] check extra properties on regexps 1eac46b
  • [Tests] update test skipping logic 8adf08d

v2.0.0 - 2019-12-03

Fixed

  • [Fix] handle circular references #19
  • [Breaking] compare Map, Set, WeakMap, WeakSet matching node assert #54 #46
  • [Breaking] compare Map, Set, WeakMap, WeakSet matching node assert #54 #46
  • [Breaking] comparing arrays and objects should always fail, per node‘s assert.deepEqual #12

Commits

  • [Tests] add passing tests from node core 91a6472
  • [Tests] convert remaining tests to use the custom assertion 2bb7269
  • [Tests] add tests for getters, fake arrays, overriding getTime on Dates 1b66d90
  • [Breaking] non-Date objects with different [[Prototypes]] are not equal 5f2f2e5
  • [Breaking] boxed primitives are not silently unboxed e207bc3
  • [Tests] run tests with assert, as well ccaf3ea
  • [Breaking] boxed primitives are unwrapped for comparisons a159a3a
  • [Refactor] use side-channel for memoizing circular refs 983780a
  • [Tests] Failing tests for Map equality 4856185
  • [Tests] add toStringTag helper bb50ea2
  • [Fix] robustly unbox boxed primitives, using unbox-primitive c455998
  • [Breaking] two objects with different Symbol.toStringTags are not equal 45431b6
  • [Tests] add more Error tests c0ae38c
  • [Breaking] ensure Error objects compare properly ffb2522
  • [Dev Deps] update eslint, @ljharb/eslint-config 737031e
  • [readme] update URLs, readme 9d300da
  • [Tests] use Buffer.from when available 43fa5da
  • [Breaking] add exports to package.json ecd15ae
  • [Tests] require ASSERT tests to pass 7ac77cf
  • [Robustness] use callBound from es-abstract 4dc3477
  • [patch] [[Prototype]]s are only compared in strict mode 43b1eef
  • [Dev Deps] update eslint, @ljharb/eslint-config, has-symbols 89228df
  • [Tests] up to node v12.9 595c81a
  • [Fix] pass options when comparing Collection keys/values 9859584
  • [Breaking] false and [] are no longer equal, even non-strictly 5c3accc
  • [Tests] only use Buffer.from when it has a length of > 1 3645129
  • [Breaking] remove lib/is-arguments and lib/keys entrypoints 783d47e
  • [Dev Deps] update eslint 7cc1dd9
  • Merge tag 'v1.1.1' f9d3c6d
  • Merge tag 'v1.1.0' 0aeca99

v1.1.2 - 2023-11-08

Commits

  • [Tests] port tests from main; only diff should be true/falses e02cadb
  • [Dev Deps] update @ljharb/eslint-config, auto-changelog, aud, eslint, set-publish-latest, tape 11bd45b
  • [Tests] update .github from default branch 58885d3
  • [readme] update readme from default branch b0bca9a
  • [Tests] add nyc for coverage e25bc37
  • [Tests] use Buffer.from when available f0d4a42
  • [Deps] update is-arguments, is-date-object, is-regex, object-is, regexp.prototype.flags 80c15ca
  • [meta] use npmignore to autogenerate an npmignore file e0770e5
  • [Deps] update is-date-object, is-regex, object-is, regexp.prototype.flags e4fb8c6
  • [Tests] handle ported test failures in iojs v2 3798ff4
  • [Dev Deps] update eslint, @ljharb/eslint-config, tape 0f8ca75
  • [Tests] handle some additional test differences in node <= 0.10 197a220
  • [meta] add missing engines.node e158993
  • [meta] update .gitignore from default branch 6ee186b
  • [Dev Deps] update tape 270d34b
  • [meta] fix URLs a269c18
  • [Tests] only use Buffer.from when it has a length of > 1 f7e5776

v1.1.1 - 2019-11-12

Commits

  • [Tests] use shared travis-ci configs 678cb2a
  • [meta] add auto-changelog 569bcce
  • [Dev Deps] update eslint, @ljharb/eslint-config; add safe-publish-latest 9dedd40
  • [Tests] add npx aud in posttest 0b76639
  • [meta] add funding field 3e519e3

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
  • [Tests] make a tape helper, to easily compare loose/strict, and (a,b)/(b,a) arg order 0c25e94
  • [Tests] add npm run lint 8590816
  • test: Fails simple array tests on IE < 9 #10 bc37498
  • [Tests] clean up/flesh out test cases 3fffed9
  • [Fix] (array,arguments) now behaves the same as (arguments,array) a9528ff
  • [Refactor] move Date and RegExp tests into objEquiv 5b3bf31
  • [Fix] properly compare RegExp objects b8c179c
  • [Refactor] Use object-keys and is-arguments instead of a homegrown shim. 3b503fb
  • [Fix] use object-is to support NaN and -0 properly 28fde4a
  • [meta] fix license text so GitHub can detect it 7000403
  • [Tests] add array/object tests 558eecf
  • [Fix] ensure Buffer + non-Buffer comparison order does not matter de4e75c
  • [Refactor] objEquiv: bail early if typeofs are different 410e2d6
  • [Tests] add tests for Object.create(null) ed266e8
  • [Refactor] there is no need to do further compareation when two types are not equal 6a5efc1
  • Only apps should have lockfiles f60442f
  • [Tests] clean up redundant test cbbef21
  • [Fix] use is-date-object to properly detect cross-realm Dates 0c5b21a
  • [meta] Add copyright statements 56a7746
  • [Dev Deps] update tape 3e9c1b9

v1.0.1 - 2015-08-29

Fixed

  • Null should == undefined #23

Commits

  • Update travis.yml to modern node 5055802

v1.0.0 - 2015-02-07

v0.2.2 - 2015-02-07

Commits

v0.2.1 - 2014-01-29

Commits

v0.2.0 - 2014-01-29

Commits

  • buffer check without Buffer 5271f39
  • failing test for buffer comparison cc8990b

v0.1.2 - 2013-12-20

Commits

  • test the arguments shim and properly factor out the arguments handling cf88b9c
  • more coverage for the keys shim 7a41f0e
  • test coverage for the non-object case abd3358
  • fix the argument comparisons to properly call equal() 0114a10
  • more code coverage for date comparisons 41ac40e
  • use the latest version of tape f8341cb
  • use https: for the badges 514b332
  • 100% coverage e55aac7

v0.1.1 - 2013-12-20

Commits

  • Fixed arguments support for IE8- 174d41a

v0.1.0 - 2013-10-14

Commits

v0.0.0 - 2012-02-10

Commits