Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/inspect-js/node-deep-equal
node's assert.deepEqual algorithm
https://github.com/inspect-js/node-deep-equal
assert deepequal equal javascript loose node nodejs strict
Last synced: 8 days ago
JSON representation
node's assert.deepEqual algorithm
- Host: GitHub
- URL: https://github.com/inspect-js/node-deep-equal
- Owner: inspect-js
- License: mit
- Created: 2012-02-11T05:41:43.000Z (almost 13 years ago)
- Default Branch: main
- Last Pushed: 2024-01-30T18:06:20.000Z (10 months ago)
- Last Synced: 2024-10-29T20:37:52.871Z (15 days ago)
- Topics: assert, deepequal, equal, javascript, loose, node, nodejs, strict
- Language: JavaScript
- Homepage:
- Size: 321 KB
- Stars: 778
- Watchers: 18
- Forks: 109
- Open Issues: 4
-
Metadata Files:
- Readme: readme.markdown
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 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