Installations
npm install nested-equal
Developer Guide
Typescript
Yes
Module System
CommonJS, ESM, UMD
Node Version
12.16.3
NPM Version
6.14.4
Contributors
Unable to fetch Contributors
Languages
TypeScript (53.81%)
JavaScript (46.19%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
alizeait
Download Statistics
Total Downloads
5,218
Last Day
5
Last Week
32
Last Month
90
Last Year
2,090
GitHub Statistics
14 Commits
1 Watching
9 Branches
1 Contributors
Bundle Size
556.00 B
Minified
335.00 B
Minified + Gzipped
Package Meta Information
Latest Version
1.0.1
Package Id
nested-equal@1.0.1
Unpacked Size
14.36 kB
Size
4.04 kB
File Count
12
NPM Version
6.14.4
Node Version
12.16.3
Total Downloads
Cumulative downloads
Total Downloads
5,218
Last day
-16.7%
5
Compared to previous day
Last week
146.2%
32
Compared to previous week
Last month
2.3%
90
Compared to previous month
Last year
70.9%
2,090
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
nested-equal
![Coverage](https://img.shields.io/codecov/c/github/alizeait/nested-equal)
A tiny (~239B) and super fast deep/nested equality utility.
Takes 2 values and returns a boolean indicating if they are equal or not by traversing recursively.
Supports Objects
, Arrays
, Numbers
, Strings
, null
, undefined
, NaN
, Functions
. Other types like Map
, Set
, Date
and others use reference equality instead of value equality.
Key order within objects does not matter while value order within arrays does matter.
Installation
1$ npm install nested-equal
Usage
1import { nestedEqual } from "nested-equal"; 2 3nestedEqual({},{}); // true 4nestedEqual({a:1},{a:1}); // true 5nestedEqual([1,2],[1,3]); // false 6nestedEqual(NaN,NaN); // true 7nestedEqual([1,2,3],[1,2,3]); // true 8nestedEqual([ 9 {a:'value',b:'value'}, 10 {a:'value',b:'value'}, 11],[ 12 {a:'value',b:'value'}, 13 {a:'value',b:'value'}, 14]) // true 15nestedEqual(5,'5'); // false 16nestedEqual(null,null); // true 17nestedEqual(null,undefined); // false
Benchmarks
Claiming a library is fast without looking into the data structure is naive at best, since the data structure largely impacts performance as no algorithm can handle all the different data structures. Hence a couple of benchmarks were made with some different data structures to compare it to other popular libararies.
Benchmark 1
lodash.isequal x 66,593 ops/sec ±0.43% (92 runs sampled)
deep-equal x 772 ops/sec ±4.45% (43 runs sampled)
nested-equal x 458,818 ops/sec ±0.40% (91 runs sampled)
dequal x 431,045 ops/sec ±0.23% (95 runs sampled)
nano-equal x 284,753 ops/sec ±0.37% (89 runs sampled)
Benchmark 2
lodash.isequal x 853,636 ops/sec ±0.67% (91 runs sampled)
deep-equal x 2,172 ops/sec ±1.83% (75 runs sampled)
nested-equal x 6,034,107 ops/sec ±0.72% (93 runs sampled)
dequal x 5,302,918 ops/sec ±0.70% (95 runs sampled)
nano-equal x 3,542,214 ops/sec ±0.24% (93 runs sampled)
Benchmark 3
lodash.isequal x 14,347,632 ops/sec ±0.89% (91 runs sampled)
deep-equal x 4,502 ops/sec ±1.76% (72 runs sampled)
nested-equal x 21,252,686 ops/sec ±0.31% (93 runs sampled)
dequal x 21,489,939 ops/sec ±0.32% (94 runs sampled)
nano-equal x 28,915,716 ops/sec ±0.49% (94 runs sampled)
Benchmark 4
lodash.isequal x 63,600 ops/sec ±1.16% (64 runs sampled)
deep-equal x 1,420 ops/sec ±0.64% (88 runs sampled)
nested-equal x 2,909,724 ops/sec ±0.22% (91 runs sampled)
dequal x 4,138,053 ops/sec ±0.25% (94 runs sampled)
nano-equal x 1,662,534 ops/sec ±2.92% (90 runs sampled)
Benchmark 5
lodash.isequal x 70,076 ops/sec ±0.93% (90 runs sampled)
deep-equal x 2,113 ops/sec ±0.54% (88 runs sampled)
nested-equal x 7,432,844 ops/sec ±0.22% (93 runs sampled)
dequal x 7,161,662 ops/sec ±0.61% (94 runs sampled)
nano-equal x 4,496,048 ops/sec ±0.59% (94 runs sampled)
Running on Node.js v12.13.0, 64-bit OS, Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz, 16.0 GB RAM
API
nestedEqual(value1:any,value2:any)
Returns: Boolean
Returns true or false indicating if the two values are equal or not.
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
SAST tool detected but not run on all commits
Details
- Info: SAST configuration detected: CodeQL
- Warn: 0 commits out of 11 are checked with a SAST tool
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/7 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql-analysis.yml:28
- Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql-analysis.yml:29
- Warn: no topLevel permission defined: .github/workflows/check.yaml:1
- Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/check.yaml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/alizeait/nested-equal/check.yaml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/check.yaml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/alizeait/nested-equal/check.yaml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/alizeait/nested-equal/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/alizeait/nested-equal/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/alizeait/nested-equal/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:70: update your workflow using https://app.stepsecurity.io/secureworkflow/alizeait/nested-equal/codeql-analysis.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/check.yaml:28
- Info: 0 out of 6 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
18 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-phwq-j96m-2c2q
- Warn: Project is vulnerable to: GHSA-ghr5-ch3p-vcr6
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488
- Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
3.2
/10
Last Scanned on 2025-02-03
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 MoreOther packages similar to nested-equal
deep-equal-in-any-order
chai plugin to match objects and arrays deep equality with arrays (including nested ones) being in any order
object-all-values-equal-to
Does the AST/nested-plain-object/array/whatever contain only one kind of value?
deep-equal-nested-array
Deep Equal for nested JSON objects along with array
equal-checker
Lightweight function to check if two Objects, Arrays, or single Values are equal. Uses Recursion to check any combination and level of NESTING.