Comparing version 1.0.1 to 2.0.0
{ | ||
"name": "dequal", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"repository": "lukeed/dequal", | ||
"description": "A tiny (305B) utility for check for deep equality", | ||
"unpkg": "dist/dequal.min.js", | ||
"module": "dist/dequal.mjs", | ||
"main": "dist/dequal.js", | ||
"types": "dequal.d.ts", | ||
"description": "A tiny (304B to 489B) utility for check for deep equality", | ||
"unpkg": "dist/index.min.js", | ||
"module": "dist/index.mjs", | ||
"main": "dist/index.js", | ||
"types": "index.d.ts", | ||
"license": "MIT", | ||
@@ -26,4 +26,20 @@ "author": { | ||
"*.d.ts", | ||
"dist" | ||
"dist", | ||
"lite" | ||
], | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
}, | ||
"./lite": { | ||
"import": "./lite/index.mjs", | ||
"require": "./lite/index.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"modes": { | ||
"lite": "src/lite.js", | ||
"default": "src/index.js" | ||
}, | ||
"keywords": [ | ||
@@ -37,4 +53,4 @@ "deep", | ||
"esm": "3.2.25", | ||
"uvu": "0.2.2" | ||
"uvu": "0.3.2" | ||
} | ||
} |
# dequal [![CI](https://github.com/lukeed/dequal/workflows/CI/badge.svg)](https://github.com/lukeed/dequal/actions) | ||
> A tiny (305B) utility to check for deep equality | ||
> A tiny (304B to 489B) utility to check for deep equality | ||
This module supports comparison of all types, including `Function`, `RegExp`, `Date`, `null`, `undefined`, and `NaN` values. Objects and Arrays are traversed recursively. | ||
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. | ||
> Please note that key order **within Objects** does not matter.<br> | ||
However, the value order **within Arrays** does matter. | ||
> **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 | ||
This module exposes three module definitions: | ||
* **CommonJS**: `dist/dequal.js` | ||
* **ESModule**: `dist/dequal.mjs` | ||
* **UMD**: `dist/dequal.min.js` | ||
## Install | ||
@@ -23,3 +20,21 @@ | ||
## Modes | ||
There are two "versions" of `dequal` available: | ||
#### `dequal` | ||
> **Size (gzip):** 489 bytes<br> | ||
> **Availability:** [CommonJS](https://unpkg.com/dequal/dist/index.js), [ES Module](https://unpkg.com/dequal/dist/index.mjs), [UMD](https://unpkg.com/dequal/dist/index.min.js) | ||
#### `dequal/lite` | ||
> **Size (gzip):** 304 bytes<br> | ||
> **Availability:** [CommonJS](https://unpkg.com/dequal/lite/index.js), [ES Module](https://unpkg.com/dequal/lite/index.mjs) | ||
| | IE9+ | Number | String | Date | RegExp | Object | Array | Class | Set | Map | ArrayBuffer | [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#TypedArray_objects) | [DataView](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/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: | | ||
> <sup>**Note:** Table scrolls horizontally!</sup> | ||
## Usage | ||
@@ -63,26 +78,33 @@ | ||
The benchmarks can be found in the [`/bench`](/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. <br>For example, `fast-deep-equal/es6` handles `Set` and `Map` values, but uses _referential equality_ while those listed use _value equality_. | ||
``` | ||
Load times: | ||
assert: 0.166ms | ||
util: 0.032ms | ||
fast-deep-equal 0.712ms | ||
lodash/isequal 24.700ms | ||
nano-equal 0.506ms | ||
dequal 0.365ms | ||
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 | ||
Validation: | ||
✔ assert.deepStrictEqual | ||
✔ util.isDeepStrictEqual | ||
✔ fast-deep-equal | ||
✔ lodash.isEqual | ||
✔ nano-equal | ||
✔ dequal | ||
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: | ||
assert.deepStrictEqual x 211,987 ops/sec ±1.47% (92 runs sampled) | ||
util.isDeepStrictEqual x 213,516 ops/sec ±1.25% (93 runs sampled) | ||
fast-deep-equal x 479,017 ops/sec ±1.15% (89 runs sampled) | ||
lodash.isEqual x 207,120 ops/sec ±0.47% (96 runs sampled) | ||
nano-equal x 409,286 ops/sec ±0.73% (97 runs sampled) | ||
dequal x 541,815 ops/sec ±0.95% (94 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) | ||
``` | ||
@@ -89,0 +111,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14049
10
197
113
1