Gathering detailed insights and metrics for dequal
Gathering detailed insights and metrics for dequal
Gathering detailed insights and metrics for dequal
Gathering detailed insights and metrics for dequal
use-deep-compare-dequal-update
React hooks, except using deep comparison on the inputs, not reference equality. Also dequal is updated.
qcompare
the fastest function for comparing two js objects compatible with es6
create-deep
Mimics SolidJS's `createSignal()` and `createMemo()` but with deep equality checks
glob-monster
File globber that understands regex
A tiny (304B to 489B) utility to check for deep equality
npm install dequal
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
1,375 Stars
58 Commits
28 Forks
17 Watching
1 Branches
4 Contributors
Updated on 28 Nov 2024
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-6.6%
2,826,344
Compared to previous day
Last week
3.7%
16,207,689
Compared to previous week
Last month
5%
67,337,977
Compared to previous month
Last year
98.1%
737,041,055
Compared to previous year
A tiny (304B to 489B) utility to check for deep equality
This module supports comparison of all types, including Function
, RegExp
, Date
, Set
, Map
, TypedArray
s, DataView
, null
, undefined
, and NaN
values. Complex values (eg, Objects, Arrays, Sets, Maps, etc) are traversed recursively.
Important:
- key order within Objects does not matter
- value order within Arrays does matter
- values within Sets and Maps use value equality
- keys within Maps use value equality
$ npm install --save dequal
There are two "versions" of dequal
available:
dequal
Size (gzip): 489 bytes
Availability: CommonJS, ES Module, UMD
dequal/lite
IE9+ | Number | String | Date | RegExp | Object | Array | Class | Set | Map | ArrayBuffer | TypedArray | DataView | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dequal | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
dequal/lite | :+1: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: |
Note: Table scrolls horizontally!
1import { dequal } from 'dequal'; 2 3dequal(1, 1); //=> true 4dequal({}, {}); //=> true 5dequal('foo', 'foo'); //=> true 6dequal([1, 2, 3], [1, 2, 3]); //=> true 7dequal(dequal, dequal); //=> true 8dequal(/foo/, /foo/); //=> true 9dequal(null, null); //=> true 10dequal(NaN, NaN); //=> true 11dequal([], []); //=> true 12dequal( 13 [{ a:1 }, [{ b:{ c:[1] } }]], 14 [{ a:1 }, [{ b:{ c:[1] } }]] 15); //=> true 16 17dequal(1, '1'); //=> false 18dequal(null, undefined); //=> false 19dequal({ a:1, b:[2,3] }, { a:1, b:[2,5] }); //=> false 20dequal(/foo/i, /bar/g); //=> false
Returns: Boolean
Both foo
and bar
can be of any type.
A Boolean
is returned indicating if the two were deeply equal.
Running Node v10.13.0
The benchmarks can be found in the /bench
directory. They are separated into two categories:
basic
– compares an object comprised of String
, Number
, Date
, Array
, and Object
values.complex
– like basic
, but adds RegExp
, Map
, Set
, and Uint8Array
values.Note: Only candidates that pass validation step(s) are listed.
For example,fast-deep-equal/es6
handlesSet
andMap
values, but uses referential equality while those listed use value equality.
Load times:
assert 0.109ms
util 0.006ms
fast-deep-equal 0.479ms
lodash/isequal 22.826ms
nano-equal 0.417ms
dequal 0.396ms
dequal/lite 0.264ms
Benchmark :: basic
assert.deepStrictEqual x 325,262 ops/sec ±0.57% (94 runs sampled)
util.isDeepStrictEqual x 318,812 ops/sec ±0.87% (94 runs sampled)
fast-deep-equal x 1,332,393 ops/sec ±0.36% (93 runs sampled)
lodash.isEqual x 269,129 ops/sec ±0.59% (95 runs sampled)
nano-equal x 1,122,053 ops/sec ±0.36% (96 runs sampled)
dequal/lite x 1,700,972 ops/sec ±0.31% (94 runs sampled)
dequal x 1,698,972 ops/sec ±0.63% (97 runs sampled)
Benchmark :: complex
assert.deepStrictEqual x 124,518 ops/sec ±0.64% (96 runs sampled)
util.isDeepStrictEqual x 125,113 ops/sec ±0.24% (96 runs sampled)
lodash.isEqual x 58,677 ops/sec ±0.49% (96 runs sampled)
dequal x 345,386 ops/sec ±0.27% (96 runs sampled)
MIT © Luke Edwards
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 4/15 approved changesets -- score normalized to 2
Reason
1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More