first commit
This commit is contained in:
13
node_modules/fast-equals/.release-it.beta.json
generated
vendored
Normal file
13
node_modules/fast-equals/.release-it.beta.json
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"github": {
|
||||
"release": true,
|
||||
"tagName": "v${version}"
|
||||
},
|
||||
"npm": {
|
||||
"tag": "next"
|
||||
},
|
||||
"preReleaseId": "beta",
|
||||
"scripts": {
|
||||
"beforeStart": "npm run prepublish:compile"
|
||||
}
|
||||
}
|
||||
9
node_modules/fast-equals/.release-it.json
generated
vendored
Normal file
9
node_modules/fast-equals/.release-it.json
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"github": {
|
||||
"release": true,
|
||||
"tagName": "v${version}"
|
||||
},
|
||||
"scripts": {
|
||||
"beforeStart": "npm run prepublish:compile"
|
||||
}
|
||||
}
|
||||
37
node_modules/fast-equals/BUILD.md
generated
vendored
Normal file
37
node_modules/fast-equals/BUILD.md
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
# Reproducing a build
|
||||
|
||||
## Clone version
|
||||
|
||||
```
|
||||
git clone https://github.com/planttheidea/fast-equals.git
|
||||
cd fast-equals
|
||||
git checkout {version}
|
||||
```
|
||||
|
||||
Replace `{version}` above with the appropriate package version. If you want to compare a version older than `1.6.2`, you'll need to use a commit hash directly.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
yarn install
|
||||
```
|
||||
|
||||
We use `yarn` for our package management, so to ensure that exact dependencies you should also use it.
|
||||
|
||||
## Build artifacts
|
||||
|
||||
```
|
||||
yarn run build
|
||||
```
|
||||
|
||||
**NOTE**: To get an exact checksum match with the versions released on npm, it may be necessary to change line endings. For example, on Linux you might run:
|
||||
|
||||
```
|
||||
unix2dos dist/fast-equals.min.js
|
||||
```
|
||||
|
||||
## Get checksum
|
||||
|
||||
```
|
||||
sha256sum dist/fast-equals.min.js
|
||||
```
|
||||
183
node_modules/fast-equals/CHANGELOG.md
generated
vendored
Normal file
183
node_modules/fast-equals/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
# fast-equals CHANGELOG
|
||||
|
||||
## 3.0.3
|
||||
|
||||
- Fix [#77](https://github.com/planttheidea/fast-equals/issues/73) - better circular object validation
|
||||
|
||||
## 3.0.2
|
||||
|
||||
- Fix [#73](https://github.com/planttheidea/fast-equals/issues/73) - support comparison of primitive wrappers
|
||||
- [#76](https://github.com/planttheidea/fast-equals/pull/76) - improve speed and accuracy of `RegExp` comparison in modern environments
|
||||
|
||||
## 3.0.1
|
||||
|
||||
- Fix [#71](https://github.com/planttheidea/fast-equals/pull/71) - use generic types for better type flow-through
|
||||
|
||||
## 3.0.0
|
||||
|
||||
### Breaking changes
|
||||
|
||||
When creating a custom equality comparator via `createCustomEqual`, the equality method has an expanded contract:
|
||||
|
||||
```ts
|
||||
// Before
|
||||
type EqualityComparator = (objectA: any, objectB: any, meta: any) => boolean;
|
||||
|
||||
// After
|
||||
type InternalEqualityComparator = (
|
||||
objectA: any,
|
||||
objectB: any,
|
||||
indexOrKeyA: any,
|
||||
indexOrKeyB: any,
|
||||
parentA: any,
|
||||
parentB: any,
|
||||
meta: any,
|
||||
) => boolean;
|
||||
```
|
||||
|
||||
If you have a custom equality comparator, you can ignore the differences by just passing additional `undefined` parameters, or you can use the parameters to further improve / clarify the logic.
|
||||
|
||||
- Add [#57](https://github.com/planttheidea/fast-equals/pull/57) - support additional metadata for custom equality comparators
|
||||
|
||||
## 2.0.4
|
||||
|
||||
- Fix [#58](https://github.com/planttheidea/fast-equals/issues/58) - duplicate entries in `Map` / `Set` can create false equality success
|
||||
- [#60](https://github.com/planttheidea/fast-equals/issues/60) - Add documentation for key equality of `Map` being a part of `deepEqual`
|
||||
|
||||
## 2.0.3
|
||||
|
||||
- Fix [#50](https://github.com/planttheidea/fast-equals/pull/50) - copy-pasta in cacheable check
|
||||
|
||||
## 2.0.2
|
||||
|
||||
- Optimize iterables comparisons to not double-iterate
|
||||
- Optimize loop-based comparisons for speed
|
||||
- Improve cache handling in circular handlers
|
||||
- Improve stability of memory by reducing variable instantiation
|
||||
|
||||
## 2.0.1
|
||||
|
||||
- Fix [#41](https://github.com/planttheidea/fast-equals/pull/41) - prevent `.rpt2_cache` directory from being published for better CI environment support (thanks [@herberttn](https://github.com/herberttn))
|
||||
|
||||
## 2.0.0
|
||||
|
||||
### Breaking changes
|
||||
|
||||
- There are longer `fast-equals/es`, `fast-equals/lib`, `fast-equals/mjs` locations
|
||||
- Instead, there are 3 builds in `dist` for different consumption types:
|
||||
- `fast-equals.js` (UMD / `browser`)
|
||||
- `fast-equals.esm.js` (ESM / `module`)
|
||||
- `fast-equals.cjs.js` (CommonJS / `main`)
|
||||
- There is no default export anymore, only the previously-existing named exports
|
||||
- To get all into a namespace, use `import * as fe from 'fast-equals`
|
||||
|
||||
### Updates
|
||||
|
||||
- Rewritten completely in TypeScript
|
||||
- Improve speed of `Map` / `Set` comparisons
|
||||
- Improve speed of React element comparisons
|
||||
|
||||
### Fixes
|
||||
|
||||
- Consider pure objects (`Object.create(null)`) to be plain objects
|
||||
- Fix typings for `createCustomEqual`
|
||||
|
||||
## 1.6.3
|
||||
|
||||
- Check the size of the iterable before converting to arrays
|
||||
|
||||
## 1.6.2
|
||||
|
||||
- Fix [#23](https://github.com/planttheidea/fast-equals/issues/23) - false positives for map
|
||||
- Replace `uglify` with `terser`
|
||||
- Use `rollup` to build all the distributables (`main`, `module`, and `browser`)
|
||||
- Maintain `lib` and `es` transpilations in case consumers were deep-linking
|
||||
|
||||
## 1.6.1
|
||||
|
||||
- Upgrade to `babel@7`
|
||||
- Add `"sideEffects": false` to `package.json` for better tree-shaking in `webpack`
|
||||
|
||||
## 1.6.0
|
||||
|
||||
- Add ESM support for NodeJS with separate [`.mjs` extension](https://nodejs.org/api/esm.html) exports
|
||||
|
||||
## 1.5.3
|
||||
|
||||
- Fix `Map` / `Set` comparison to not require order to match to be equal
|
||||
|
||||
## 1.5.2
|
||||
|
||||
- Improve speed of object comparison through custom `hasKey` method
|
||||
|
||||
## 1.5.1
|
||||
|
||||
- Fix lack of support for `unicode` and `sticky` RegExp flag checks
|
||||
|
||||
## 1.5.0
|
||||
|
||||
- Add [`circularDeepEqual`](README.md#circulardeepequal) and [`circularShallowEqual`](README.md#circularshallowequal) methods
|
||||
- Add `meta` third parameter to `comparator` calls, for use with `createCustomEqual` method
|
||||
|
||||
## 1.4.1
|
||||
|
||||
- Fix issue where `lastIndex` was not being tested on `RegExp` objects
|
||||
|
||||
## 1.4.0
|
||||
|
||||
- Add support for comparing promise-like objects (strict equality only)
|
||||
|
||||
## 1.3.1
|
||||
|
||||
- Make `react` comparison more accurate, and a touch faster
|
||||
|
||||
## 1.3.0
|
||||
|
||||
- Add support for deep-equal comparisons between `react` elements
|
||||
- Add comparison with `react-fast-compare`
|
||||
- Use `rollup` for `dist` file builds
|
||||
|
||||
## 1.2.1
|
||||
|
||||
- Fix errors from TypeScript typings in strict mode (thanks [@HitoriSensei](https://github.com/HitoriSensei))
|
||||
|
||||
## 1.2.0
|
||||
|
||||
- Surface `isSameValueZero` as [`sameValueZeroEqual`](#samevaluezeroequal) option
|
||||
|
||||
## 1.1.0
|
||||
|
||||
- Add TypeScript typings (thanks [@josh-sachs](https://github.com/josh-sachs))
|
||||
|
||||
## 1.0.6
|
||||
|
||||
- Support invalid date equality via `isSameValueZero`
|
||||
|
||||
## 1.0.5
|
||||
|
||||
- Replace `isStrictlyEqual` with `isSameValueZero` to ensure that `shallowEqual` accounts for `NaN` equality
|
||||
|
||||
## 1.0.4
|
||||
|
||||
- Only check values when comparing `Set` objects (improves performance of `Set` check by ~12%)
|
||||
|
||||
## 1.0.3
|
||||
|
||||
- Make `Map` and `Set` comparisons more explicit
|
||||
|
||||
## 1.0.2
|
||||
|
||||
- Fix symmetrical comparison of iterables
|
||||
- Reduce footprint
|
||||
|
||||
## 1.0.1
|
||||
|
||||
- Prevent babel transpilation of `typeof` into helper for faster runtime
|
||||
|
||||
## 1.0.0
|
||||
|
||||
- Initial release
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
21
node_modules/fast-equals/LICENSE
generated
vendored
Normal file
21
node_modules/fast-equals/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Tony Quetano
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
265
node_modules/fast-equals/README.md
generated
vendored
Normal file
265
node_modules/fast-equals/README.md
generated
vendored
Normal file
@@ -0,0 +1,265 @@
|
||||
# fast-equals
|
||||
|
||||
<img src="https://img.shields.io/badge/build-passing-brightgreen.svg"/>
|
||||
<img src="https://img.shields.io/badge/coverage-100%25-brightgreen.svg"/>
|
||||
<img src="https://img.shields.io/badge/license-MIT-blue.svg"/>
|
||||
|
||||
Perform [blazing fast](#benchmarks) equality comparisons (either deep or shallow) on two objects passed. It has no dependencies, and is ~1kB when minified and gzipped.
|
||||
|
||||
Unlike most equality validation libraries, the following types are handled out-of-the-box:
|
||||
|
||||
- `NaN`
|
||||
- `Date` objects
|
||||
- `RegExp` objects
|
||||
- `Map` / `Set` iterables
|
||||
- `Promise` objects
|
||||
- `react` elements
|
||||
|
||||
Starting with version `1.5.0`, circular objects are supported for both deep and shallow equality (see [`circularDeepEqual`](#circulardeepequal) and [`circularShallowEqual`](#circularshallowequal)). You can also create a custom nested comparator, for specific scenarios ([see below](#createcustomequal)).
|
||||
|
||||
## Table of contents
|
||||
|
||||
- [fast-equals](#fast-equals)
|
||||
- [Table of contents](#table-of-contents)
|
||||
- [Usage](#usage)
|
||||
- [Specific builds](#specific-builds)
|
||||
- [Available methods](#available-methods)
|
||||
- [deepEqual](#deepequal)
|
||||
- [Comparing `Map`s](#comparing-maps)
|
||||
- [shallowEqual](#shallowequal)
|
||||
- [sameValueZeroEqual](#samevaluezeroequal)
|
||||
- [circularDeepEqual](#circulardeepequal)
|
||||
- [circularShallowEqual](#circularshallowequal)
|
||||
- [createCustomEqual](#createcustomequal)
|
||||
- [Benchmarks](#benchmarks)
|
||||
- [Development](#development)
|
||||
|
||||
## Usage
|
||||
|
||||
You can either import the individual functions desired:
|
||||
|
||||
```javascript
|
||||
import { deepEqual } from 'fast-equals';
|
||||
|
||||
console.log(deepEqual({ foo: 'bar' }, { foo: 'bar' })); // true
|
||||
```
|
||||
|
||||
Or if you want to import all functions under a namespace:
|
||||
|
||||
```javascript
|
||||
import * as fe from 'fast-equals';
|
||||
|
||||
console.log(fe.deep({ foo: 'bar' }, { foo: 'bar' })); // true
|
||||
```
|
||||
|
||||
### Specific builds
|
||||
|
||||
There are three builds, an ESM build for modern build systems / runtimes, a CommonJS build for traditional NodeJS environments, and a UMD build for legacy implementations. The ideal one will likely be chosen for you automatically, however if you want to use a specific build you can always import it directly:
|
||||
|
||||
- ESM => `fast-equals/dist/fast-equals.esm.js`
|
||||
- For older `nodejs` versions that do not allow ESM with file extensions other than `.mjs` => `fast-equals/dist/fast-equals.mjs`
|
||||
- CommonJS => `fast-equals/dist/fast-equals.cjs.js`
|
||||
- UMD => `fast-equals/dist/fast-equals.js`
|
||||
|
||||
There is also a pre-minified version of the UMD build available:
|
||||
|
||||
- Minified UMD => `fast-equals/dist/fast-equals.min.js`
|
||||
|
||||
## Available methods
|
||||
|
||||
### deepEqual
|
||||
|
||||
Performs a deep equality comparison on the two objects passed and returns a boolean representing the value equivalency of the objects.
|
||||
|
||||
```javascript
|
||||
import { deepEqual } from 'fast-equals';
|
||||
|
||||
const objectA = { foo: { bar: 'baz' } };
|
||||
const objectB = { foo: { bar: 'baz' } };
|
||||
|
||||
console.log(objectA === objectB); // false
|
||||
console.log(deepEqual(objectA, objectB)); // true
|
||||
```
|
||||
|
||||
#### Comparing `Map`s
|
||||
|
||||
`Map` objects support complex keys (objects, Arrays, etc.), however [the spec for key lookups in `Map` are based on `SameZeroValue`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#key_equality). If the spec were followed for comparison, the following would always be `false`:
|
||||
|
||||
```javascript
|
||||
const mapA = new Map([[{ foo: 'bar' }, { baz: 'quz' }]]);
|
||||
const mapB = new Map([[{ foo: 'bar' }, { baz: 'quz' }]]);
|
||||
|
||||
deepEqual(mapA, mapB);
|
||||
```
|
||||
|
||||
To support true deep equality of all contents, `fast-equals` will perform a deep equality comparison for key and value parirs. Therefore, the above would be `true`.
|
||||
|
||||
### shallowEqual
|
||||
|
||||
Performs a shallow equality comparison on the two objects passed and returns a boolean representing the value equivalency of the objects.
|
||||
|
||||
```javascript
|
||||
import { shallowEqual } from 'fast-equals';
|
||||
|
||||
const nestedObject = { bar: 'baz' };
|
||||
|
||||
const objectA = { foo: nestedObject };
|
||||
const objectB = { foo: nestedObject };
|
||||
const objectC = { foo: { bar: 'baz' } };
|
||||
|
||||
console.log(objectA === objectB); // false
|
||||
console.log(shallowEqual(objectA, objectB)); // true
|
||||
console.log(shallowEqual(objectA, objectC)); // false
|
||||
```
|
||||
|
||||
### sameValueZeroEqual
|
||||
|
||||
Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) comparison on the two objects passed and returns a boolean representing the value equivalency of the objects. In simple terms, this means either strictly equal or both `NaN`.
|
||||
|
||||
```javascript
|
||||
import { sameValueZeroEqual } from 'fast-equals';
|
||||
|
||||
const mainObject = { foo: NaN, bar: 'baz' };
|
||||
|
||||
const objectA = 'baz';
|
||||
const objectB = NaN;
|
||||
const objectC = { foo: NaN, bar: 'baz' };
|
||||
|
||||
console.log(sameValueZeroEqual(mainObject.bar, objectA)); // true
|
||||
console.log(sameValueZeroEqual(mainObject.foo, objectB)); // true
|
||||
console.log(sameValueZeroEqual(mainObject, objectC)); // false
|
||||
```
|
||||
|
||||
### circularDeepEqual
|
||||
|
||||
Performs the same comparison as `deepEqual` but supports circular objects. It is slower than `deepEqual`, so only use if you know circular objects are present.
|
||||
|
||||
```javascript
|
||||
function Circular(value) {
|
||||
this.me = {
|
||||
deeply: {
|
||||
nested: {
|
||||
reference: this,
|
||||
},
|
||||
},
|
||||
value,
|
||||
};
|
||||
}
|
||||
|
||||
console.log(circularDeepEqual(new Circular('foo'), new Circular('foo'))); // true
|
||||
console.log(circularDeepEqual(new Circular('foo'), new Circular('bar'))); // false
|
||||
```
|
||||
|
||||
Just as with `deepEqual`, [both keys and values are compared for deep equality](#comparing-maps).
|
||||
|
||||
### circularShallowEqual
|
||||
|
||||
Performs the same comparison as `shallowequal` but supports circular objects. It is slower than `shallowEqual`, so only use if you know circular objects are present.
|
||||
|
||||
```javascript
|
||||
const array = ['foo'];
|
||||
|
||||
array.push(array);
|
||||
|
||||
console.log(circularShallowEqual(array, ['foo', array])); // true
|
||||
console.log(circularShallowEqual(array, [array])); // false
|
||||
```
|
||||
|
||||
### createCustomEqual
|
||||
|
||||
Creates a custom equality comparator that will be used on nested values in the object. Unlike `deepEqual` and `shallowEqual`, this is a partial-application function that will receive the internal comparator and should return a function that compares two objects.
|
||||
|
||||
The signature is as follows:
|
||||
|
||||
```typescript
|
||||
type EqualityComparator = (a: any, b: any, meta?: any) => boolean;
|
||||
type InternalEqualityComparator = (a: any, b: any, indexOrKeyA: any, indexOrKeyB: any, parentA: any, parentB: any, meta: any) => boolean;
|
||||
type EqualityComparatorCreator = (
|
||||
deepEqual: EqualityComparator,
|
||||
) => InternalEqualityComparator;
|
||||
|
||||
function createCustomEqual(
|
||||
createIsEqual?: EqualityComparatorCreator,
|
||||
): EqualityComparator;
|
||||
```
|
||||
|
||||
The `meta` parameter in `EqualityComparator` and `InternalEqualityComparator` is whatever you want it to be. It will be passed through to all equality checks, and is meant specifically for use with custom equality methods. For example, with the `circularDeepEqual` and `circularShallowEqual` methods, it is used to pass through a cache of processed objects.
|
||||
|
||||
_**NOTE**: `Map` implementations compare equality for both keys and value. When using a custom comparator and comparing equality of the keys, the iteration index is provided as both `indexOrKeyA` and `indexOrKeyB` to help use-cases where ordering of keys matters to equality._
|
||||
|
||||
An example for a custom equality comparison that also checks against values in the meta object:
|
||||
|
||||
```javascript
|
||||
import { createCustomEqual } from 'fast-equals';
|
||||
|
||||
const isDeepEqualOrFooMatchesMeta = createCustomEqual(
|
||||
(deepEqual) => (objectA, objectB, indexOrKeyA, indexOrKeyB, parentA, parentB, meta) =>
|
||||
objectA.foo === meta ||
|
||||
objectB.foo === meta ||
|
||||
deepEqual(objectA, objectB, meta),
|
||||
);
|
||||
|
||||
const objectA = { foo: 'bar' };
|
||||
const objectB = { foo: 'baz' };
|
||||
const meta = 'bar';
|
||||
|
||||
console.log(isDeepEqualOrFooMatchesMeta(objectA, objectB, meta)); // true
|
||||
```
|
||||
|
||||
## Benchmarks
|
||||
|
||||
All benchmarks were performed on an i7-8650U Ubuntu Linux laptop with 24GB of memory using NodeJS version `12.19.1`, and are based on averages of running comparisons based deep equality on the following object types:
|
||||
|
||||
- Primitives (`String`, `Number`, `null`, `undefined`)
|
||||
- `Function`
|
||||
- `Object`
|
||||
- `Array`
|
||||
- `Date`
|
||||
- `RegExp`
|
||||
- `react` elements
|
||||
- A mixed object with a combination of all the above types
|
||||
|
||||
| | Operations / second |
|
||||
| -------------------------- | ------------------- |
|
||||
| **fast-equals** | **153,880** |
|
||||
| fast-deep-equal | 144,035 |
|
||||
| react-fast-compare | 130,324 |
|
||||
| nano-equal | 104,624 |
|
||||
| **fast-equals (circular)** | **97,610** |
|
||||
| shallow-equal-fuzzy | 83,946 |
|
||||
| underscore.isEqual | 47,370 |
|
||||
| lodash.isEqual | 25,053 |
|
||||
| deep-eql | 22,146 |
|
||||
| assert.deepStrictEqual | 532 |
|
||||
| deep-equal | 209 |
|
||||
|
||||
Caveats that impact the benchmark (and accuracy of comparison):
|
||||
|
||||
- `Map`s, `Promise`s, and `Set`s were excluded from the benchmark entirely because no library other than `deep-eql` fully supported their comparison
|
||||
- `assert.deepStrictEqual` does not support `NaN` or `SameValueZero` equality for dates
|
||||
- `deep-eql` does not support `SameValueZero` equality for zero equality (positive and negative zero are not equal)
|
||||
- `deep-equal` does not support `NaN` and does not strictly compare object type, or date / regexp values, nor uses `SameValueZero` equality for dates
|
||||
- `fast-deep-equal` does not support `NaN` or `SameValueZero` equality for dates
|
||||
- `nano-equal` does not strictly compare object property structure, array length, or object type, nor `SameValueZero` equality for dates
|
||||
- `react-fast-compare` does not support `NaN` or `SameValueZero` equality for dates, and does not compare `function` equality
|
||||
- `shallow-equal-fuzzy` does not strictly compare object type or regexp values, nor `SameValueZero` equality for dates
|
||||
- `underscore.isEqual` does not support `SameValueZero` equality for primitives or dates
|
||||
|
||||
All of these have the potential of inflating the respective library's numbers in comparison to `fast-equals`, but it was the closest apples-to-apples comparison I could create of a reasonable sample size. It should be noted that `react` elements can be circular objects, however simple elements are not; I kept the `react` comparison very basic to allow it to be included.
|
||||
|
||||
## Development
|
||||
|
||||
Standard practice, clone the repo and `npm i` to get the dependencies. The following npm scripts are available:
|
||||
|
||||
- benchmark => run benchmark tests against other equality libraries
|
||||
- build => build `main`, `module`, and `browser` distributables with `rollup`
|
||||
- clean => run `rimraf` on the `dist` folder
|
||||
- dev => start webpack playground App
|
||||
- dist => run `build`
|
||||
- lint => run ESLint on all files in `src` folder (also runs on `dev` script)
|
||||
- lint:fix => run `lint` script, but with auto-fixer
|
||||
- prepublish:compile => run `lint`, `test:coverage`, `transpile:lib`, `transpile:es`, and `dist` scripts
|
||||
- start => run `dev`
|
||||
- test => run AVA with NODE_ENV=test on all files in `test` folder
|
||||
- test:coverage => run same script as `test` with code coverage calculation via `nyc`
|
||||
- test:watch => run same script as `test` but keep persistent watcher
|
||||
353
node_modules/fast-equals/dist/fast-equals.cjs.js
generated
vendored
Normal file
353
node_modules/fast-equals/dist/fast-equals.cjs.js
generated
vendored
Normal file
@@ -0,0 +1,353 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var HAS_WEAK_MAP_SUPPORT = typeof WeakMap === 'function';
|
||||
var keys = Object.keys;
|
||||
/**
|
||||
* are the values passed strictly equal or both NaN
|
||||
*
|
||||
* @param a the value to compare against
|
||||
* @param b the value to test
|
||||
* @returns are the values equal by the SameValueZero principle
|
||||
*/
|
||||
function sameValueZeroEqual(a, b) {
|
||||
return a === b || (a !== a && b !== b);
|
||||
}
|
||||
/**
|
||||
* is the value a plain object
|
||||
*
|
||||
* @param value the value to test
|
||||
* @returns is the value a plain object
|
||||
*/
|
||||
function isPlainObject(value) {
|
||||
return value.constructor === Object || value.constructor == null;
|
||||
}
|
||||
/**
|
||||
* is the value promise-like (meaning it is thenable)
|
||||
*
|
||||
* @param value the value to test
|
||||
* @returns is the value promise-like
|
||||
*/
|
||||
function isPromiseLike(value) {
|
||||
return !!value && typeof value.then === 'function';
|
||||
}
|
||||
/**
|
||||
* is the value passed a react element
|
||||
*
|
||||
* @param value the value to test
|
||||
* @returns is the value a react element
|
||||
*/
|
||||
function isReactElement(value) {
|
||||
return !!(value && value.$$typeof);
|
||||
}
|
||||
/**
|
||||
* in cases where WeakMap is not supported, creates a new custom
|
||||
* object that mimics the necessary API aspects for cache purposes
|
||||
*
|
||||
* @returns the new cache object
|
||||
*/
|
||||
function getNewCacheFallback() {
|
||||
var entries = [];
|
||||
return {
|
||||
delete: function (key) {
|
||||
for (var index = 0; index < entries.length; ++index) {
|
||||
if (entries[index][0] === key) {
|
||||
entries.splice(index, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
get: function (key) {
|
||||
for (var index = 0; index < entries.length; ++index) {
|
||||
if (entries[index][0] === key) {
|
||||
return entries[index][1];
|
||||
}
|
||||
}
|
||||
},
|
||||
set: function (key, value) {
|
||||
for (var index = 0; index < entries.length; ++index) {
|
||||
if (entries[index][0] === key) {
|
||||
entries[index][1] = value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
entries.push([key, value]);
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* get a new cache object to prevent circular references
|
||||
*
|
||||
* @returns the new cache object
|
||||
*/
|
||||
var getNewCache = (function (canUseWeakMap) {
|
||||
if (canUseWeakMap) {
|
||||
return function _getNewCache() {
|
||||
return new WeakMap();
|
||||
};
|
||||
}
|
||||
return getNewCacheFallback;
|
||||
})(HAS_WEAK_MAP_SUPPORT);
|
||||
/**
|
||||
* create a custom isEqual handler specific to circular objects
|
||||
*
|
||||
* @param [isEqual] the isEqual comparator to use instead of isDeepEqual
|
||||
* @returns the method to create the `isEqual` function
|
||||
*/
|
||||
function createCircularEqualCreator(isEqual) {
|
||||
return function createCircularEqual(comparator) {
|
||||
var _comparator = isEqual || comparator;
|
||||
return function circularEqual(a, b, indexOrKeyA, indexOrKeyB, parentA, parentB, cache) {
|
||||
if (cache === void 0) { cache = getNewCache(); }
|
||||
var isCacheableA = !!a && typeof a === 'object';
|
||||
var isCacheableB = !!b && typeof b === 'object';
|
||||
if (isCacheableA !== isCacheableB) {
|
||||
return false;
|
||||
}
|
||||
if (!isCacheableA && !isCacheableB) {
|
||||
return _comparator(a, b, cache);
|
||||
}
|
||||
var cachedA = cache.get(a);
|
||||
if (cachedA && cache.get(b)) {
|
||||
return cachedA === b;
|
||||
}
|
||||
cache.set(a, b);
|
||||
cache.set(b, a);
|
||||
var result = _comparator(a, b, cache);
|
||||
cache.delete(a);
|
||||
cache.delete(b);
|
||||
return result;
|
||||
};
|
||||
};
|
||||
}
|
||||
/**
|
||||
* are the arrays equal in value
|
||||
*
|
||||
* @param a the array to test
|
||||
* @param b the array to test against
|
||||
* @param isEqual the comparator to determine equality
|
||||
* @param meta the meta object to pass through
|
||||
* @returns are the arrays equal
|
||||
*/
|
||||
function areArraysEqual(a, b, isEqual, meta) {
|
||||
var index = a.length;
|
||||
if (b.length !== index) {
|
||||
return false;
|
||||
}
|
||||
while (index-- > 0) {
|
||||
if (!isEqual(a[index], b[index], index, index, a, b, meta)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* are the maps equal in value
|
||||
*
|
||||
* @param a the map to test
|
||||
* @param b the map to test against
|
||||
* @param isEqual the comparator to determine equality
|
||||
* @param meta the meta map to pass through
|
||||
* @returns are the maps equal
|
||||
*/
|
||||
function areMapsEqual(a, b, isEqual, meta) {
|
||||
var isValueEqual = a.size === b.size;
|
||||
if (isValueEqual && a.size) {
|
||||
var matchedIndices_1 = {};
|
||||
var indexA_1 = 0;
|
||||
a.forEach(function (aValue, aKey) {
|
||||
if (isValueEqual) {
|
||||
var hasMatch_1 = false;
|
||||
var matchIndexB_1 = 0;
|
||||
b.forEach(function (bValue, bKey) {
|
||||
if (!hasMatch_1 && !matchedIndices_1[matchIndexB_1]) {
|
||||
hasMatch_1 =
|
||||
isEqual(aKey, bKey, indexA_1, matchIndexB_1, a, b, meta) &&
|
||||
isEqual(aValue, bValue, aKey, bKey, a, b, meta);
|
||||
if (hasMatch_1) {
|
||||
matchedIndices_1[matchIndexB_1] = true;
|
||||
}
|
||||
}
|
||||
matchIndexB_1++;
|
||||
});
|
||||
indexA_1++;
|
||||
isValueEqual = hasMatch_1;
|
||||
}
|
||||
});
|
||||
}
|
||||
return isValueEqual;
|
||||
}
|
||||
var OWNER = '_owner';
|
||||
var hasOwnProperty = Function.prototype.bind.call(Function.prototype.call, Object.prototype.hasOwnProperty);
|
||||
/**
|
||||
* are the objects equal in value
|
||||
*
|
||||
* @param a the object to test
|
||||
* @param b the object to test against
|
||||
* @param isEqual the comparator to determine equality
|
||||
* @param meta the meta object to pass through
|
||||
* @returns are the objects equal
|
||||
*/
|
||||
function areObjectsEqual(a, b, isEqual, meta) {
|
||||
var keysA = keys(a);
|
||||
var index = keysA.length;
|
||||
if (keys(b).length !== index) {
|
||||
return false;
|
||||
}
|
||||
if (index) {
|
||||
var key = void 0;
|
||||
while (index-- > 0) {
|
||||
key = keysA[index];
|
||||
if (key === OWNER) {
|
||||
var reactElementA = isReactElement(a);
|
||||
var reactElementB = isReactElement(b);
|
||||
if ((reactElementA || reactElementB) &&
|
||||
reactElementA !== reactElementB) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!hasOwnProperty(b, key) ||
|
||||
!isEqual(a[key], b[key], key, key, a, b, meta)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* are the regExps equal in value
|
||||
*
|
||||
* @param a the regExp to test
|
||||
* @param b the regExp to test agains
|
||||
* @returns are the regExps equal
|
||||
*/
|
||||
var areRegExpsEqual = (function () {
|
||||
if (/foo/g.flags === 'g') {
|
||||
return function areRegExpsEqual(a, b) {
|
||||
return a.source === b.source && a.flags === b.flags;
|
||||
};
|
||||
}
|
||||
return function areRegExpsEqualFallback(a, b) {
|
||||
return (a.source === b.source &&
|
||||
a.global === b.global &&
|
||||
a.ignoreCase === b.ignoreCase &&
|
||||
a.multiline === b.multiline &&
|
||||
a.unicode === b.unicode &&
|
||||
a.sticky === b.sticky &&
|
||||
a.lastIndex === b.lastIndex);
|
||||
};
|
||||
})();
|
||||
/**
|
||||
* are the sets equal in value
|
||||
*
|
||||
* @param a the set to test
|
||||
* @param b the set to test against
|
||||
* @param isEqual the comparator to determine equality
|
||||
* @param meta the meta set to pass through
|
||||
* @returns are the sets equal
|
||||
*/
|
||||
function areSetsEqual(a, b, isEqual, meta) {
|
||||
var isValueEqual = a.size === b.size;
|
||||
if (isValueEqual && a.size) {
|
||||
var matchedIndices_2 = {};
|
||||
a.forEach(function (aValue, aKey) {
|
||||
if (isValueEqual) {
|
||||
var hasMatch_2 = false;
|
||||
var matchIndex_1 = 0;
|
||||
b.forEach(function (bValue, bKey) {
|
||||
if (!hasMatch_2 && !matchedIndices_2[matchIndex_1]) {
|
||||
hasMatch_2 = isEqual(aValue, bValue, aKey, bKey, a, b, meta);
|
||||
if (hasMatch_2) {
|
||||
matchedIndices_2[matchIndex_1] = true;
|
||||
}
|
||||
}
|
||||
matchIndex_1++;
|
||||
});
|
||||
isValueEqual = hasMatch_2;
|
||||
}
|
||||
});
|
||||
}
|
||||
return isValueEqual;
|
||||
}
|
||||
|
||||
var HAS_MAP_SUPPORT = typeof Map === 'function';
|
||||
var HAS_SET_SUPPORT = typeof Set === 'function';
|
||||
var valueOf = Object.prototype.valueOf;
|
||||
function createComparator(createIsEqual) {
|
||||
var isEqual =
|
||||
/* eslint-disable no-use-before-define */
|
||||
typeof createIsEqual === 'function'
|
||||
? createIsEqual(comparator)
|
||||
: function (a, b, indexOrKeyA, indexOrKeyB, parentA, parentB, meta) { return comparator(a, b, meta); };
|
||||
/* eslint-enable */
|
||||
/**
|
||||
* compare the value of the two objects and return true if they are equivalent in values
|
||||
*
|
||||
* @param a the value to test against
|
||||
* @param b the value to test
|
||||
* @param [meta] an optional meta object that is passed through to all equality test calls
|
||||
* @returns are a and b equivalent in value
|
||||
*/
|
||||
function comparator(a, b, meta) {
|
||||
if (a === b) {
|
||||
return true;
|
||||
}
|
||||
if (a && b && typeof a === 'object' && typeof b === 'object') {
|
||||
if (isPlainObject(a) && isPlainObject(b)) {
|
||||
return areObjectsEqual(a, b, isEqual, meta);
|
||||
}
|
||||
var aShape = Array.isArray(a);
|
||||
var bShape = Array.isArray(b);
|
||||
if (aShape || bShape) {
|
||||
return aShape === bShape && areArraysEqual(a, b, isEqual, meta);
|
||||
}
|
||||
aShape = a instanceof Date;
|
||||
bShape = b instanceof Date;
|
||||
if (aShape || bShape) {
|
||||
return (aShape === bShape && sameValueZeroEqual(a.getTime(), b.getTime()));
|
||||
}
|
||||
aShape = a instanceof RegExp;
|
||||
bShape = b instanceof RegExp;
|
||||
if (aShape || bShape) {
|
||||
return aShape === bShape && areRegExpsEqual(a, b);
|
||||
}
|
||||
if (isPromiseLike(a) || isPromiseLike(b)) {
|
||||
return a === b;
|
||||
}
|
||||
if (HAS_MAP_SUPPORT) {
|
||||
aShape = a instanceof Map;
|
||||
bShape = b instanceof Map;
|
||||
if (aShape || bShape) {
|
||||
return aShape === bShape && areMapsEqual(a, b, isEqual, meta);
|
||||
}
|
||||
}
|
||||
if (HAS_SET_SUPPORT) {
|
||||
aShape = a instanceof Set;
|
||||
bShape = b instanceof Set;
|
||||
if (aShape || bShape) {
|
||||
return aShape === bShape && areSetsEqual(a, b, isEqual, meta);
|
||||
}
|
||||
}
|
||||
if (a.valueOf !== valueOf || b.valueOf !== valueOf) {
|
||||
return sameValueZeroEqual(a.valueOf(), b.valueOf());
|
||||
}
|
||||
return areObjectsEqual(a, b, isEqual, meta);
|
||||
}
|
||||
return a !== a && b !== b;
|
||||
}
|
||||
return comparator;
|
||||
}
|
||||
|
||||
var deepEqual = createComparator();
|
||||
var shallowEqual = createComparator(function () { return sameValueZeroEqual; });
|
||||
var circularDeepEqual = createComparator(createCircularEqualCreator());
|
||||
var circularShallowEqual = createComparator(createCircularEqualCreator(sameValueZeroEqual));
|
||||
|
||||
exports.circularDeepEqual = circularDeepEqual;
|
||||
exports.circularShallowEqual = circularShallowEqual;
|
||||
exports.createCustomEqual = createComparator;
|
||||
exports.deepEqual = deepEqual;
|
||||
exports.sameValueZeroEqual = sameValueZeroEqual;
|
||||
exports.shallowEqual = shallowEqual;
|
||||
//# sourceMappingURL=fast-equals.cjs.js.map
|
||||
1
node_modules/fast-equals/dist/fast-equals.cjs.js.map
generated
vendored
Normal file
1
node_modules/fast-equals/dist/fast-equals.cjs.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
344
node_modules/fast-equals/dist/fast-equals.esm.js
generated
vendored
Normal file
344
node_modules/fast-equals/dist/fast-equals.esm.js
generated
vendored
Normal file
@@ -0,0 +1,344 @@
|
||||
var HAS_WEAK_MAP_SUPPORT = typeof WeakMap === 'function';
|
||||
var keys = Object.keys;
|
||||
/**
|
||||
* are the values passed strictly equal or both NaN
|
||||
*
|
||||
* @param a the value to compare against
|
||||
* @param b the value to test
|
||||
* @returns are the values equal by the SameValueZero principle
|
||||
*/
|
||||
function sameValueZeroEqual(a, b) {
|
||||
return a === b || (a !== a && b !== b);
|
||||
}
|
||||
/**
|
||||
* is the value a plain object
|
||||
*
|
||||
* @param value the value to test
|
||||
* @returns is the value a plain object
|
||||
*/
|
||||
function isPlainObject(value) {
|
||||
return value.constructor === Object || value.constructor == null;
|
||||
}
|
||||
/**
|
||||
* is the value promise-like (meaning it is thenable)
|
||||
*
|
||||
* @param value the value to test
|
||||
* @returns is the value promise-like
|
||||
*/
|
||||
function isPromiseLike(value) {
|
||||
return !!value && typeof value.then === 'function';
|
||||
}
|
||||
/**
|
||||
* is the value passed a react element
|
||||
*
|
||||
* @param value the value to test
|
||||
* @returns is the value a react element
|
||||
*/
|
||||
function isReactElement(value) {
|
||||
return !!(value && value.$$typeof);
|
||||
}
|
||||
/**
|
||||
* in cases where WeakMap is not supported, creates a new custom
|
||||
* object that mimics the necessary API aspects for cache purposes
|
||||
*
|
||||
* @returns the new cache object
|
||||
*/
|
||||
function getNewCacheFallback() {
|
||||
var entries = [];
|
||||
return {
|
||||
delete: function (key) {
|
||||
for (var index = 0; index < entries.length; ++index) {
|
||||
if (entries[index][0] === key) {
|
||||
entries.splice(index, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
get: function (key) {
|
||||
for (var index = 0; index < entries.length; ++index) {
|
||||
if (entries[index][0] === key) {
|
||||
return entries[index][1];
|
||||
}
|
||||
}
|
||||
},
|
||||
set: function (key, value) {
|
||||
for (var index = 0; index < entries.length; ++index) {
|
||||
if (entries[index][0] === key) {
|
||||
entries[index][1] = value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
entries.push([key, value]);
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* get a new cache object to prevent circular references
|
||||
*
|
||||
* @returns the new cache object
|
||||
*/
|
||||
var getNewCache = (function (canUseWeakMap) {
|
||||
if (canUseWeakMap) {
|
||||
return function _getNewCache() {
|
||||
return new WeakMap();
|
||||
};
|
||||
}
|
||||
return getNewCacheFallback;
|
||||
})(HAS_WEAK_MAP_SUPPORT);
|
||||
/**
|
||||
* create a custom isEqual handler specific to circular objects
|
||||
*
|
||||
* @param [isEqual] the isEqual comparator to use instead of isDeepEqual
|
||||
* @returns the method to create the `isEqual` function
|
||||
*/
|
||||
function createCircularEqualCreator(isEqual) {
|
||||
return function createCircularEqual(comparator) {
|
||||
var _comparator = isEqual || comparator;
|
||||
return function circularEqual(a, b, indexOrKeyA, indexOrKeyB, parentA, parentB, cache) {
|
||||
if (cache === void 0) { cache = getNewCache(); }
|
||||
var isCacheableA = !!a && typeof a === 'object';
|
||||
var isCacheableB = !!b && typeof b === 'object';
|
||||
if (isCacheableA !== isCacheableB) {
|
||||
return false;
|
||||
}
|
||||
if (!isCacheableA && !isCacheableB) {
|
||||
return _comparator(a, b, cache);
|
||||
}
|
||||
var cachedA = cache.get(a);
|
||||
if (cachedA && cache.get(b)) {
|
||||
return cachedA === b;
|
||||
}
|
||||
cache.set(a, b);
|
||||
cache.set(b, a);
|
||||
var result = _comparator(a, b, cache);
|
||||
cache.delete(a);
|
||||
cache.delete(b);
|
||||
return result;
|
||||
};
|
||||
};
|
||||
}
|
||||
/**
|
||||
* are the arrays equal in value
|
||||
*
|
||||
* @param a the array to test
|
||||
* @param b the array to test against
|
||||
* @param isEqual the comparator to determine equality
|
||||
* @param meta the meta object to pass through
|
||||
* @returns are the arrays equal
|
||||
*/
|
||||
function areArraysEqual(a, b, isEqual, meta) {
|
||||
var index = a.length;
|
||||
if (b.length !== index) {
|
||||
return false;
|
||||
}
|
||||
while (index-- > 0) {
|
||||
if (!isEqual(a[index], b[index], index, index, a, b, meta)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* are the maps equal in value
|
||||
*
|
||||
* @param a the map to test
|
||||
* @param b the map to test against
|
||||
* @param isEqual the comparator to determine equality
|
||||
* @param meta the meta map to pass through
|
||||
* @returns are the maps equal
|
||||
*/
|
||||
function areMapsEqual(a, b, isEqual, meta) {
|
||||
var isValueEqual = a.size === b.size;
|
||||
if (isValueEqual && a.size) {
|
||||
var matchedIndices_1 = {};
|
||||
var indexA_1 = 0;
|
||||
a.forEach(function (aValue, aKey) {
|
||||
if (isValueEqual) {
|
||||
var hasMatch_1 = false;
|
||||
var matchIndexB_1 = 0;
|
||||
b.forEach(function (bValue, bKey) {
|
||||
if (!hasMatch_1 && !matchedIndices_1[matchIndexB_1]) {
|
||||
hasMatch_1 =
|
||||
isEqual(aKey, bKey, indexA_1, matchIndexB_1, a, b, meta) &&
|
||||
isEqual(aValue, bValue, aKey, bKey, a, b, meta);
|
||||
if (hasMatch_1) {
|
||||
matchedIndices_1[matchIndexB_1] = true;
|
||||
}
|
||||
}
|
||||
matchIndexB_1++;
|
||||
});
|
||||
indexA_1++;
|
||||
isValueEqual = hasMatch_1;
|
||||
}
|
||||
});
|
||||
}
|
||||
return isValueEqual;
|
||||
}
|
||||
var OWNER = '_owner';
|
||||
var hasOwnProperty = Function.prototype.bind.call(Function.prototype.call, Object.prototype.hasOwnProperty);
|
||||
/**
|
||||
* are the objects equal in value
|
||||
*
|
||||
* @param a the object to test
|
||||
* @param b the object to test against
|
||||
* @param isEqual the comparator to determine equality
|
||||
* @param meta the meta object to pass through
|
||||
* @returns are the objects equal
|
||||
*/
|
||||
function areObjectsEqual(a, b, isEqual, meta) {
|
||||
var keysA = keys(a);
|
||||
var index = keysA.length;
|
||||
if (keys(b).length !== index) {
|
||||
return false;
|
||||
}
|
||||
if (index) {
|
||||
var key = void 0;
|
||||
while (index-- > 0) {
|
||||
key = keysA[index];
|
||||
if (key === OWNER) {
|
||||
var reactElementA = isReactElement(a);
|
||||
var reactElementB = isReactElement(b);
|
||||
if ((reactElementA || reactElementB) &&
|
||||
reactElementA !== reactElementB) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!hasOwnProperty(b, key) ||
|
||||
!isEqual(a[key], b[key], key, key, a, b, meta)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* are the regExps equal in value
|
||||
*
|
||||
* @param a the regExp to test
|
||||
* @param b the regExp to test agains
|
||||
* @returns are the regExps equal
|
||||
*/
|
||||
var areRegExpsEqual = (function () {
|
||||
if (/foo/g.flags === 'g') {
|
||||
return function areRegExpsEqual(a, b) {
|
||||
return a.source === b.source && a.flags === b.flags;
|
||||
};
|
||||
}
|
||||
return function areRegExpsEqualFallback(a, b) {
|
||||
return (a.source === b.source &&
|
||||
a.global === b.global &&
|
||||
a.ignoreCase === b.ignoreCase &&
|
||||
a.multiline === b.multiline &&
|
||||
a.unicode === b.unicode &&
|
||||
a.sticky === b.sticky &&
|
||||
a.lastIndex === b.lastIndex);
|
||||
};
|
||||
})();
|
||||
/**
|
||||
* are the sets equal in value
|
||||
*
|
||||
* @param a the set to test
|
||||
* @param b the set to test against
|
||||
* @param isEqual the comparator to determine equality
|
||||
* @param meta the meta set to pass through
|
||||
* @returns are the sets equal
|
||||
*/
|
||||
function areSetsEqual(a, b, isEqual, meta) {
|
||||
var isValueEqual = a.size === b.size;
|
||||
if (isValueEqual && a.size) {
|
||||
var matchedIndices_2 = {};
|
||||
a.forEach(function (aValue, aKey) {
|
||||
if (isValueEqual) {
|
||||
var hasMatch_2 = false;
|
||||
var matchIndex_1 = 0;
|
||||
b.forEach(function (bValue, bKey) {
|
||||
if (!hasMatch_2 && !matchedIndices_2[matchIndex_1]) {
|
||||
hasMatch_2 = isEqual(aValue, bValue, aKey, bKey, a, b, meta);
|
||||
if (hasMatch_2) {
|
||||
matchedIndices_2[matchIndex_1] = true;
|
||||
}
|
||||
}
|
||||
matchIndex_1++;
|
||||
});
|
||||
isValueEqual = hasMatch_2;
|
||||
}
|
||||
});
|
||||
}
|
||||
return isValueEqual;
|
||||
}
|
||||
|
||||
var HAS_MAP_SUPPORT = typeof Map === 'function';
|
||||
var HAS_SET_SUPPORT = typeof Set === 'function';
|
||||
var valueOf = Object.prototype.valueOf;
|
||||
function createComparator(createIsEqual) {
|
||||
var isEqual =
|
||||
/* eslint-disable no-use-before-define */
|
||||
typeof createIsEqual === 'function'
|
||||
? createIsEqual(comparator)
|
||||
: function (a, b, indexOrKeyA, indexOrKeyB, parentA, parentB, meta) { return comparator(a, b, meta); };
|
||||
/* eslint-enable */
|
||||
/**
|
||||
* compare the value of the two objects and return true if they are equivalent in values
|
||||
*
|
||||
* @param a the value to test against
|
||||
* @param b the value to test
|
||||
* @param [meta] an optional meta object that is passed through to all equality test calls
|
||||
* @returns are a and b equivalent in value
|
||||
*/
|
||||
function comparator(a, b, meta) {
|
||||
if (a === b) {
|
||||
return true;
|
||||
}
|
||||
if (a && b && typeof a === 'object' && typeof b === 'object') {
|
||||
if (isPlainObject(a) && isPlainObject(b)) {
|
||||
return areObjectsEqual(a, b, isEqual, meta);
|
||||
}
|
||||
var aShape = Array.isArray(a);
|
||||
var bShape = Array.isArray(b);
|
||||
if (aShape || bShape) {
|
||||
return aShape === bShape && areArraysEqual(a, b, isEqual, meta);
|
||||
}
|
||||
aShape = a instanceof Date;
|
||||
bShape = b instanceof Date;
|
||||
if (aShape || bShape) {
|
||||
return (aShape === bShape && sameValueZeroEqual(a.getTime(), b.getTime()));
|
||||
}
|
||||
aShape = a instanceof RegExp;
|
||||
bShape = b instanceof RegExp;
|
||||
if (aShape || bShape) {
|
||||
return aShape === bShape && areRegExpsEqual(a, b);
|
||||
}
|
||||
if (isPromiseLike(a) || isPromiseLike(b)) {
|
||||
return a === b;
|
||||
}
|
||||
if (HAS_MAP_SUPPORT) {
|
||||
aShape = a instanceof Map;
|
||||
bShape = b instanceof Map;
|
||||
if (aShape || bShape) {
|
||||
return aShape === bShape && areMapsEqual(a, b, isEqual, meta);
|
||||
}
|
||||
}
|
||||
if (HAS_SET_SUPPORT) {
|
||||
aShape = a instanceof Set;
|
||||
bShape = b instanceof Set;
|
||||
if (aShape || bShape) {
|
||||
return aShape === bShape && areSetsEqual(a, b, isEqual, meta);
|
||||
}
|
||||
}
|
||||
if (a.valueOf !== valueOf || b.valueOf !== valueOf) {
|
||||
return sameValueZeroEqual(a.valueOf(), b.valueOf());
|
||||
}
|
||||
return areObjectsEqual(a, b, isEqual, meta);
|
||||
}
|
||||
return a !== a && b !== b;
|
||||
}
|
||||
return comparator;
|
||||
}
|
||||
|
||||
var deepEqual = createComparator();
|
||||
var shallowEqual = createComparator(function () { return sameValueZeroEqual; });
|
||||
var circularDeepEqual = createComparator(createCircularEqualCreator());
|
||||
var circularShallowEqual = createComparator(createCircularEqualCreator(sameValueZeroEqual));
|
||||
|
||||
export { circularDeepEqual, circularShallowEqual, createComparator as createCustomEqual, deepEqual, sameValueZeroEqual, shallowEqual };
|
||||
//# sourceMappingURL=fast-equals.esm.js.map
|
||||
1
node_modules/fast-equals/dist/fast-equals.esm.js.map
generated
vendored
Normal file
1
node_modules/fast-equals/dist/fast-equals.esm.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
359
node_modules/fast-equals/dist/fast-equals.js
generated
vendored
Normal file
359
node_modules/fast-equals/dist/fast-equals.js
generated
vendored
Normal file
@@ -0,0 +1,359 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["fast-equals"] = {}));
|
||||
})(this, (function (exports) { 'use strict';
|
||||
|
||||
var HAS_WEAK_MAP_SUPPORT = typeof WeakMap === 'function';
|
||||
var keys = Object.keys;
|
||||
/**
|
||||
* are the values passed strictly equal or both NaN
|
||||
*
|
||||
* @param a the value to compare against
|
||||
* @param b the value to test
|
||||
* @returns are the values equal by the SameValueZero principle
|
||||
*/
|
||||
function sameValueZeroEqual(a, b) {
|
||||
return a === b || (a !== a && b !== b);
|
||||
}
|
||||
/**
|
||||
* is the value a plain object
|
||||
*
|
||||
* @param value the value to test
|
||||
* @returns is the value a plain object
|
||||
*/
|
||||
function isPlainObject(value) {
|
||||
return value.constructor === Object || value.constructor == null;
|
||||
}
|
||||
/**
|
||||
* is the value promise-like (meaning it is thenable)
|
||||
*
|
||||
* @param value the value to test
|
||||
* @returns is the value promise-like
|
||||
*/
|
||||
function isPromiseLike(value) {
|
||||
return !!value && typeof value.then === 'function';
|
||||
}
|
||||
/**
|
||||
* is the value passed a react element
|
||||
*
|
||||
* @param value the value to test
|
||||
* @returns is the value a react element
|
||||
*/
|
||||
function isReactElement(value) {
|
||||
return !!(value && value.$$typeof);
|
||||
}
|
||||
/**
|
||||
* in cases where WeakMap is not supported, creates a new custom
|
||||
* object that mimics the necessary API aspects for cache purposes
|
||||
*
|
||||
* @returns the new cache object
|
||||
*/
|
||||
function getNewCacheFallback() {
|
||||
var entries = [];
|
||||
return {
|
||||
delete: function (key) {
|
||||
for (var index = 0; index < entries.length; ++index) {
|
||||
if (entries[index][0] === key) {
|
||||
entries.splice(index, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
get: function (key) {
|
||||
for (var index = 0; index < entries.length; ++index) {
|
||||
if (entries[index][0] === key) {
|
||||
return entries[index][1];
|
||||
}
|
||||
}
|
||||
},
|
||||
set: function (key, value) {
|
||||
for (var index = 0; index < entries.length; ++index) {
|
||||
if (entries[index][0] === key) {
|
||||
entries[index][1] = value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
entries.push([key, value]);
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* get a new cache object to prevent circular references
|
||||
*
|
||||
* @returns the new cache object
|
||||
*/
|
||||
var getNewCache = (function (canUseWeakMap) {
|
||||
if (canUseWeakMap) {
|
||||
return function _getNewCache() {
|
||||
return new WeakMap();
|
||||
};
|
||||
}
|
||||
return getNewCacheFallback;
|
||||
})(HAS_WEAK_MAP_SUPPORT);
|
||||
/**
|
||||
* create a custom isEqual handler specific to circular objects
|
||||
*
|
||||
* @param [isEqual] the isEqual comparator to use instead of isDeepEqual
|
||||
* @returns the method to create the `isEqual` function
|
||||
*/
|
||||
function createCircularEqualCreator(isEqual) {
|
||||
return function createCircularEqual(comparator) {
|
||||
var _comparator = isEqual || comparator;
|
||||
return function circularEqual(a, b, indexOrKeyA, indexOrKeyB, parentA, parentB, cache) {
|
||||
if (cache === void 0) { cache = getNewCache(); }
|
||||
var isCacheableA = !!a && typeof a === 'object';
|
||||
var isCacheableB = !!b && typeof b === 'object';
|
||||
if (isCacheableA !== isCacheableB) {
|
||||
return false;
|
||||
}
|
||||
if (!isCacheableA && !isCacheableB) {
|
||||
return _comparator(a, b, cache);
|
||||
}
|
||||
var cachedA = cache.get(a);
|
||||
if (cachedA && cache.get(b)) {
|
||||
return cachedA === b;
|
||||
}
|
||||
cache.set(a, b);
|
||||
cache.set(b, a);
|
||||
var result = _comparator(a, b, cache);
|
||||
cache.delete(a);
|
||||
cache.delete(b);
|
||||
return result;
|
||||
};
|
||||
};
|
||||
}
|
||||
/**
|
||||
* are the arrays equal in value
|
||||
*
|
||||
* @param a the array to test
|
||||
* @param b the array to test against
|
||||
* @param isEqual the comparator to determine equality
|
||||
* @param meta the meta object to pass through
|
||||
* @returns are the arrays equal
|
||||
*/
|
||||
function areArraysEqual(a, b, isEqual, meta) {
|
||||
var index = a.length;
|
||||
if (b.length !== index) {
|
||||
return false;
|
||||
}
|
||||
while (index-- > 0) {
|
||||
if (!isEqual(a[index], b[index], index, index, a, b, meta)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* are the maps equal in value
|
||||
*
|
||||
* @param a the map to test
|
||||
* @param b the map to test against
|
||||
* @param isEqual the comparator to determine equality
|
||||
* @param meta the meta map to pass through
|
||||
* @returns are the maps equal
|
||||
*/
|
||||
function areMapsEqual(a, b, isEqual, meta) {
|
||||
var isValueEqual = a.size === b.size;
|
||||
if (isValueEqual && a.size) {
|
||||
var matchedIndices_1 = {};
|
||||
var indexA_1 = 0;
|
||||
a.forEach(function (aValue, aKey) {
|
||||
if (isValueEqual) {
|
||||
var hasMatch_1 = false;
|
||||
var matchIndexB_1 = 0;
|
||||
b.forEach(function (bValue, bKey) {
|
||||
if (!hasMatch_1 && !matchedIndices_1[matchIndexB_1]) {
|
||||
hasMatch_1 =
|
||||
isEqual(aKey, bKey, indexA_1, matchIndexB_1, a, b, meta) &&
|
||||
isEqual(aValue, bValue, aKey, bKey, a, b, meta);
|
||||
if (hasMatch_1) {
|
||||
matchedIndices_1[matchIndexB_1] = true;
|
||||
}
|
||||
}
|
||||
matchIndexB_1++;
|
||||
});
|
||||
indexA_1++;
|
||||
isValueEqual = hasMatch_1;
|
||||
}
|
||||
});
|
||||
}
|
||||
return isValueEqual;
|
||||
}
|
||||
var OWNER = '_owner';
|
||||
var hasOwnProperty = Function.prototype.bind.call(Function.prototype.call, Object.prototype.hasOwnProperty);
|
||||
/**
|
||||
* are the objects equal in value
|
||||
*
|
||||
* @param a the object to test
|
||||
* @param b the object to test against
|
||||
* @param isEqual the comparator to determine equality
|
||||
* @param meta the meta object to pass through
|
||||
* @returns are the objects equal
|
||||
*/
|
||||
function areObjectsEqual(a, b, isEqual, meta) {
|
||||
var keysA = keys(a);
|
||||
var index = keysA.length;
|
||||
if (keys(b).length !== index) {
|
||||
return false;
|
||||
}
|
||||
if (index) {
|
||||
var key = void 0;
|
||||
while (index-- > 0) {
|
||||
key = keysA[index];
|
||||
if (key === OWNER) {
|
||||
var reactElementA = isReactElement(a);
|
||||
var reactElementB = isReactElement(b);
|
||||
if ((reactElementA || reactElementB) &&
|
||||
reactElementA !== reactElementB) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!hasOwnProperty(b, key) ||
|
||||
!isEqual(a[key], b[key], key, key, a, b, meta)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* are the regExps equal in value
|
||||
*
|
||||
* @param a the regExp to test
|
||||
* @param b the regExp to test agains
|
||||
* @returns are the regExps equal
|
||||
*/
|
||||
var areRegExpsEqual = (function () {
|
||||
if (/foo/g.flags === 'g') {
|
||||
return function areRegExpsEqual(a, b) {
|
||||
return a.source === b.source && a.flags === b.flags;
|
||||
};
|
||||
}
|
||||
return function areRegExpsEqualFallback(a, b) {
|
||||
return (a.source === b.source &&
|
||||
a.global === b.global &&
|
||||
a.ignoreCase === b.ignoreCase &&
|
||||
a.multiline === b.multiline &&
|
||||
a.unicode === b.unicode &&
|
||||
a.sticky === b.sticky &&
|
||||
a.lastIndex === b.lastIndex);
|
||||
};
|
||||
})();
|
||||
/**
|
||||
* are the sets equal in value
|
||||
*
|
||||
* @param a the set to test
|
||||
* @param b the set to test against
|
||||
* @param isEqual the comparator to determine equality
|
||||
* @param meta the meta set to pass through
|
||||
* @returns are the sets equal
|
||||
*/
|
||||
function areSetsEqual(a, b, isEqual, meta) {
|
||||
var isValueEqual = a.size === b.size;
|
||||
if (isValueEqual && a.size) {
|
||||
var matchedIndices_2 = {};
|
||||
a.forEach(function (aValue, aKey) {
|
||||
if (isValueEqual) {
|
||||
var hasMatch_2 = false;
|
||||
var matchIndex_1 = 0;
|
||||
b.forEach(function (bValue, bKey) {
|
||||
if (!hasMatch_2 && !matchedIndices_2[matchIndex_1]) {
|
||||
hasMatch_2 = isEqual(aValue, bValue, aKey, bKey, a, b, meta);
|
||||
if (hasMatch_2) {
|
||||
matchedIndices_2[matchIndex_1] = true;
|
||||
}
|
||||
}
|
||||
matchIndex_1++;
|
||||
});
|
||||
isValueEqual = hasMatch_2;
|
||||
}
|
||||
});
|
||||
}
|
||||
return isValueEqual;
|
||||
}
|
||||
|
||||
var HAS_MAP_SUPPORT = typeof Map === 'function';
|
||||
var HAS_SET_SUPPORT = typeof Set === 'function';
|
||||
var valueOf = Object.prototype.valueOf;
|
||||
function createComparator(createIsEqual) {
|
||||
var isEqual =
|
||||
/* eslint-disable no-use-before-define */
|
||||
typeof createIsEqual === 'function'
|
||||
? createIsEqual(comparator)
|
||||
: function (a, b, indexOrKeyA, indexOrKeyB, parentA, parentB, meta) { return comparator(a, b, meta); };
|
||||
/* eslint-enable */
|
||||
/**
|
||||
* compare the value of the two objects and return true if they are equivalent in values
|
||||
*
|
||||
* @param a the value to test against
|
||||
* @param b the value to test
|
||||
* @param [meta] an optional meta object that is passed through to all equality test calls
|
||||
* @returns are a and b equivalent in value
|
||||
*/
|
||||
function comparator(a, b, meta) {
|
||||
if (a === b) {
|
||||
return true;
|
||||
}
|
||||
if (a && b && typeof a === 'object' && typeof b === 'object') {
|
||||
if (isPlainObject(a) && isPlainObject(b)) {
|
||||
return areObjectsEqual(a, b, isEqual, meta);
|
||||
}
|
||||
var aShape = Array.isArray(a);
|
||||
var bShape = Array.isArray(b);
|
||||
if (aShape || bShape) {
|
||||
return aShape === bShape && areArraysEqual(a, b, isEqual, meta);
|
||||
}
|
||||
aShape = a instanceof Date;
|
||||
bShape = b instanceof Date;
|
||||
if (aShape || bShape) {
|
||||
return (aShape === bShape && sameValueZeroEqual(a.getTime(), b.getTime()));
|
||||
}
|
||||
aShape = a instanceof RegExp;
|
||||
bShape = b instanceof RegExp;
|
||||
if (aShape || bShape) {
|
||||
return aShape === bShape && areRegExpsEqual(a, b);
|
||||
}
|
||||
if (isPromiseLike(a) || isPromiseLike(b)) {
|
||||
return a === b;
|
||||
}
|
||||
if (HAS_MAP_SUPPORT) {
|
||||
aShape = a instanceof Map;
|
||||
bShape = b instanceof Map;
|
||||
if (aShape || bShape) {
|
||||
return aShape === bShape && areMapsEqual(a, b, isEqual, meta);
|
||||
}
|
||||
}
|
||||
if (HAS_SET_SUPPORT) {
|
||||
aShape = a instanceof Set;
|
||||
bShape = b instanceof Set;
|
||||
if (aShape || bShape) {
|
||||
return aShape === bShape && areSetsEqual(a, b, isEqual, meta);
|
||||
}
|
||||
}
|
||||
if (a.valueOf !== valueOf || b.valueOf !== valueOf) {
|
||||
return sameValueZeroEqual(a.valueOf(), b.valueOf());
|
||||
}
|
||||
return areObjectsEqual(a, b, isEqual, meta);
|
||||
}
|
||||
return a !== a && b !== b;
|
||||
}
|
||||
return comparator;
|
||||
}
|
||||
|
||||
var deepEqual = createComparator();
|
||||
var shallowEqual = createComparator(function () { return sameValueZeroEqual; });
|
||||
var circularDeepEqual = createComparator(createCircularEqualCreator());
|
||||
var circularShallowEqual = createComparator(createCircularEqualCreator(sameValueZeroEqual));
|
||||
|
||||
exports.circularDeepEqual = circularDeepEqual;
|
||||
exports.circularShallowEqual = circularShallowEqual;
|
||||
exports.createCustomEqual = createComparator;
|
||||
exports.deepEqual = deepEqual;
|
||||
exports.sameValueZeroEqual = sameValueZeroEqual;
|
||||
exports.shallowEqual = shallowEqual;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=fast-equals.js.map
|
||||
1
node_modules/fast-equals/dist/fast-equals.js.map
generated
vendored
Normal file
1
node_modules/fast-equals/dist/fast-equals.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/fast-equals/dist/fast-equals.min.js
generated
vendored
Normal file
1
node_modules/fast-equals/dist/fast-equals.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["fast-equals"]={})}(this,(function(e){"use strict";var t="function"==typeof WeakMap,n=Object.keys;function r(e,t){return e===t||e!=e&&t!=t}function o(e){return e.constructor===Object||null==e.constructor}function u(e){return!!e&&"function"==typeof e.then}function f(e){return!(!e||!e.$$typeof)}function i(){var e=[];return{delete:function(t){for(var n=0;n<e.length;++n)if(e[n][0]===t)return void e.splice(n,1)},get:function(t){for(var n=0;n<e.length;++n)if(e[n][0]===t)return e[n][1]},set:function(t,n){for(var r=0;r<e.length;++r)if(e[r][0]===t)return void(e[r][1]=n);e.push([t,n])}}}var a=t?function(){return new WeakMap}:i;function c(e){return function(t){var n=e||t;return function(e,t,r,o,u,f,i){void 0===i&&(i=a());var c=!!e&&"object"==typeof e,l=!!t&&"object"==typeof t;if(c!==l)return!1;if(!c&&!l)return n(e,t,i);var s=i.get(e);if(s&&i.get(t))return s===t;i.set(e,t),i.set(t,e);var p=n(e,t,i);return i.delete(e),i.delete(t),p}}}var l=Function.prototype.bind.call(Function.prototype.call,Object.prototype.hasOwnProperty);function s(e,t,r,o){var u=n(e),i=u.length;if(n(t).length!==i)return!1;if(i)for(var a=void 0;i-- >0;){if("_owner"===(a=u[i])){var c=f(e),s=f(t);if((c||s)&&c!==s)return!1}if(!l(t,a)||!r(e[a],t[a],a,a,e,t,o))return!1}return!0}var p="g"===/foo/g.flags?function(e,t){return e.source===t.source&&e.flags===t.flags}:function(e,t){return e.source===t.source&&e.global===t.global&&e.ignoreCase===t.ignoreCase&&e.multiline===t.multiline&&e.unicode===t.unicode&&e.sticky===t.sticky&&e.lastIndex===t.lastIndex};var v="function"==typeof Map,y="function"==typeof Set,g=Object.prototype.valueOf;function d(e){var t="function"==typeof e?e(n):function(e,t,r,o,u,f,i){return n(e,t,i)};function n(e,n,f){if(e===n)return!0;if(e&&n&&"object"==typeof e&&"object"==typeof n){if(o(e)&&o(n))return s(e,n,t,f);var i=Array.isArray(e),a=Array.isArray(n);return i||a?i===a&&function(e,t,n,r){var o=e.length;if(t.length!==o)return!1;for(;o-- >0;)if(!n(e[o],t[o],o,o,e,t,r))return!1;return!0}(e,n,t,f):(i=e instanceof Date,a=n instanceof Date,i||a?i===a&&r(e.getTime(),n.getTime()):(i=e instanceof RegExp,a=n instanceof RegExp,i||a?i===a&&p(e,n):u(e)||u(n)?e===n:v&&(i=e instanceof Map,a=n instanceof Map,i||a)?i===a&&function(e,t,n,r){var o=e.size===t.size;if(o&&e.size){var u={},f=0;e.forEach((function(i,a){if(o){var c=!1,l=0;t.forEach((function(o,s){c||u[l]||(c=n(a,s,f,l,e,t,r)&&n(i,o,a,s,e,t,r))&&(u[l]=!0),l++})),f++,o=c}}))}return o}(e,n,t,f):y&&(i=e instanceof Set,a=n instanceof Set,i||a)?i===a&&function(e,t,n,r){var o=e.size===t.size;if(o&&e.size){var u={};e.forEach((function(f,i){if(o){var a=!1,c=0;t.forEach((function(o,l){a||u[c]||(a=n(f,o,i,l,e,t,r))&&(u[c]=!0),c++})),o=a}}))}return o}(e,n,t,f):e.valueOf!==g||n.valueOf!==g?r(e.valueOf(),n.valueOf()):s(e,n,t,f)))}return e!=e&&n!=n}return n}var h=d(),b=d((function(){return r})),E=d(c()),O=d(c(r));e.circularDeepEqual=E,e.circularShallowEqual=O,e.createCustomEqual=d,e.deepEqual=h,e.sameValueZeroEqual=r,e.shallowEqual=b,Object.defineProperty(e,"__esModule",{value:!0})}));
|
||||
344
node_modules/fast-equals/dist/fast-equals.mjs
generated
vendored
Normal file
344
node_modules/fast-equals/dist/fast-equals.mjs
generated
vendored
Normal file
@@ -0,0 +1,344 @@
|
||||
var HAS_WEAK_MAP_SUPPORT = typeof WeakMap === 'function';
|
||||
var keys = Object.keys;
|
||||
/**
|
||||
* are the values passed strictly equal or both NaN
|
||||
*
|
||||
* @param a the value to compare against
|
||||
* @param b the value to test
|
||||
* @returns are the values equal by the SameValueZero principle
|
||||
*/
|
||||
function sameValueZeroEqual(a, b) {
|
||||
return a === b || (a !== a && b !== b);
|
||||
}
|
||||
/**
|
||||
* is the value a plain object
|
||||
*
|
||||
* @param value the value to test
|
||||
* @returns is the value a plain object
|
||||
*/
|
||||
function isPlainObject(value) {
|
||||
return value.constructor === Object || value.constructor == null;
|
||||
}
|
||||
/**
|
||||
* is the value promise-like (meaning it is thenable)
|
||||
*
|
||||
* @param value the value to test
|
||||
* @returns is the value promise-like
|
||||
*/
|
||||
function isPromiseLike(value) {
|
||||
return !!value && typeof value.then === 'function';
|
||||
}
|
||||
/**
|
||||
* is the value passed a react element
|
||||
*
|
||||
* @param value the value to test
|
||||
* @returns is the value a react element
|
||||
*/
|
||||
function isReactElement(value) {
|
||||
return !!(value && value.$$typeof);
|
||||
}
|
||||
/**
|
||||
* in cases where WeakMap is not supported, creates a new custom
|
||||
* object that mimics the necessary API aspects for cache purposes
|
||||
*
|
||||
* @returns the new cache object
|
||||
*/
|
||||
function getNewCacheFallback() {
|
||||
var entries = [];
|
||||
return {
|
||||
delete: function (key) {
|
||||
for (var index = 0; index < entries.length; ++index) {
|
||||
if (entries[index][0] === key) {
|
||||
entries.splice(index, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
get: function (key) {
|
||||
for (var index = 0; index < entries.length; ++index) {
|
||||
if (entries[index][0] === key) {
|
||||
return entries[index][1];
|
||||
}
|
||||
}
|
||||
},
|
||||
set: function (key, value) {
|
||||
for (var index = 0; index < entries.length; ++index) {
|
||||
if (entries[index][0] === key) {
|
||||
entries[index][1] = value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
entries.push([key, value]);
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* get a new cache object to prevent circular references
|
||||
*
|
||||
* @returns the new cache object
|
||||
*/
|
||||
var getNewCache = (function (canUseWeakMap) {
|
||||
if (canUseWeakMap) {
|
||||
return function _getNewCache() {
|
||||
return new WeakMap();
|
||||
};
|
||||
}
|
||||
return getNewCacheFallback;
|
||||
})(HAS_WEAK_MAP_SUPPORT);
|
||||
/**
|
||||
* create a custom isEqual handler specific to circular objects
|
||||
*
|
||||
* @param [isEqual] the isEqual comparator to use instead of isDeepEqual
|
||||
* @returns the method to create the `isEqual` function
|
||||
*/
|
||||
function createCircularEqualCreator(isEqual) {
|
||||
return function createCircularEqual(comparator) {
|
||||
var _comparator = isEqual || comparator;
|
||||
return function circularEqual(a, b, indexOrKeyA, indexOrKeyB, parentA, parentB, cache) {
|
||||
if (cache === void 0) { cache = getNewCache(); }
|
||||
var isCacheableA = !!a && typeof a === 'object';
|
||||
var isCacheableB = !!b && typeof b === 'object';
|
||||
if (isCacheableA !== isCacheableB) {
|
||||
return false;
|
||||
}
|
||||
if (!isCacheableA && !isCacheableB) {
|
||||
return _comparator(a, b, cache);
|
||||
}
|
||||
var cachedA = cache.get(a);
|
||||
if (cachedA && cache.get(b)) {
|
||||
return cachedA === b;
|
||||
}
|
||||
cache.set(a, b);
|
||||
cache.set(b, a);
|
||||
var result = _comparator(a, b, cache);
|
||||
cache.delete(a);
|
||||
cache.delete(b);
|
||||
return result;
|
||||
};
|
||||
};
|
||||
}
|
||||
/**
|
||||
* are the arrays equal in value
|
||||
*
|
||||
* @param a the array to test
|
||||
* @param b the array to test against
|
||||
* @param isEqual the comparator to determine equality
|
||||
* @param meta the meta object to pass through
|
||||
* @returns are the arrays equal
|
||||
*/
|
||||
function areArraysEqual(a, b, isEqual, meta) {
|
||||
var index = a.length;
|
||||
if (b.length !== index) {
|
||||
return false;
|
||||
}
|
||||
while (index-- > 0) {
|
||||
if (!isEqual(a[index], b[index], index, index, a, b, meta)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* are the maps equal in value
|
||||
*
|
||||
* @param a the map to test
|
||||
* @param b the map to test against
|
||||
* @param isEqual the comparator to determine equality
|
||||
* @param meta the meta map to pass through
|
||||
* @returns are the maps equal
|
||||
*/
|
||||
function areMapsEqual(a, b, isEqual, meta) {
|
||||
var isValueEqual = a.size === b.size;
|
||||
if (isValueEqual && a.size) {
|
||||
var matchedIndices_1 = {};
|
||||
var indexA_1 = 0;
|
||||
a.forEach(function (aValue, aKey) {
|
||||
if (isValueEqual) {
|
||||
var hasMatch_1 = false;
|
||||
var matchIndexB_1 = 0;
|
||||
b.forEach(function (bValue, bKey) {
|
||||
if (!hasMatch_1 && !matchedIndices_1[matchIndexB_1]) {
|
||||
hasMatch_1 =
|
||||
isEqual(aKey, bKey, indexA_1, matchIndexB_1, a, b, meta) &&
|
||||
isEqual(aValue, bValue, aKey, bKey, a, b, meta);
|
||||
if (hasMatch_1) {
|
||||
matchedIndices_1[matchIndexB_1] = true;
|
||||
}
|
||||
}
|
||||
matchIndexB_1++;
|
||||
});
|
||||
indexA_1++;
|
||||
isValueEqual = hasMatch_1;
|
||||
}
|
||||
});
|
||||
}
|
||||
return isValueEqual;
|
||||
}
|
||||
var OWNER = '_owner';
|
||||
var hasOwnProperty = Function.prototype.bind.call(Function.prototype.call, Object.prototype.hasOwnProperty);
|
||||
/**
|
||||
* are the objects equal in value
|
||||
*
|
||||
* @param a the object to test
|
||||
* @param b the object to test against
|
||||
* @param isEqual the comparator to determine equality
|
||||
* @param meta the meta object to pass through
|
||||
* @returns are the objects equal
|
||||
*/
|
||||
function areObjectsEqual(a, b, isEqual, meta) {
|
||||
var keysA = keys(a);
|
||||
var index = keysA.length;
|
||||
if (keys(b).length !== index) {
|
||||
return false;
|
||||
}
|
||||
if (index) {
|
||||
var key = void 0;
|
||||
while (index-- > 0) {
|
||||
key = keysA[index];
|
||||
if (key === OWNER) {
|
||||
var reactElementA = isReactElement(a);
|
||||
var reactElementB = isReactElement(b);
|
||||
if ((reactElementA || reactElementB) &&
|
||||
reactElementA !== reactElementB) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!hasOwnProperty(b, key) ||
|
||||
!isEqual(a[key], b[key], key, key, a, b, meta)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* are the regExps equal in value
|
||||
*
|
||||
* @param a the regExp to test
|
||||
* @param b the regExp to test agains
|
||||
* @returns are the regExps equal
|
||||
*/
|
||||
var areRegExpsEqual = (function () {
|
||||
if (/foo/g.flags === 'g') {
|
||||
return function areRegExpsEqual(a, b) {
|
||||
return a.source === b.source && a.flags === b.flags;
|
||||
};
|
||||
}
|
||||
return function areRegExpsEqualFallback(a, b) {
|
||||
return (a.source === b.source &&
|
||||
a.global === b.global &&
|
||||
a.ignoreCase === b.ignoreCase &&
|
||||
a.multiline === b.multiline &&
|
||||
a.unicode === b.unicode &&
|
||||
a.sticky === b.sticky &&
|
||||
a.lastIndex === b.lastIndex);
|
||||
};
|
||||
})();
|
||||
/**
|
||||
* are the sets equal in value
|
||||
*
|
||||
* @param a the set to test
|
||||
* @param b the set to test against
|
||||
* @param isEqual the comparator to determine equality
|
||||
* @param meta the meta set to pass through
|
||||
* @returns are the sets equal
|
||||
*/
|
||||
function areSetsEqual(a, b, isEqual, meta) {
|
||||
var isValueEqual = a.size === b.size;
|
||||
if (isValueEqual && a.size) {
|
||||
var matchedIndices_2 = {};
|
||||
a.forEach(function (aValue, aKey) {
|
||||
if (isValueEqual) {
|
||||
var hasMatch_2 = false;
|
||||
var matchIndex_1 = 0;
|
||||
b.forEach(function (bValue, bKey) {
|
||||
if (!hasMatch_2 && !matchedIndices_2[matchIndex_1]) {
|
||||
hasMatch_2 = isEqual(aValue, bValue, aKey, bKey, a, b, meta);
|
||||
if (hasMatch_2) {
|
||||
matchedIndices_2[matchIndex_1] = true;
|
||||
}
|
||||
}
|
||||
matchIndex_1++;
|
||||
});
|
||||
isValueEqual = hasMatch_2;
|
||||
}
|
||||
});
|
||||
}
|
||||
return isValueEqual;
|
||||
}
|
||||
|
||||
var HAS_MAP_SUPPORT = typeof Map === 'function';
|
||||
var HAS_SET_SUPPORT = typeof Set === 'function';
|
||||
var valueOf = Object.prototype.valueOf;
|
||||
function createComparator(createIsEqual) {
|
||||
var isEqual =
|
||||
/* eslint-disable no-use-before-define */
|
||||
typeof createIsEqual === 'function'
|
||||
? createIsEqual(comparator)
|
||||
: function (a, b, indexOrKeyA, indexOrKeyB, parentA, parentB, meta) { return comparator(a, b, meta); };
|
||||
/* eslint-enable */
|
||||
/**
|
||||
* compare the value of the two objects and return true if they are equivalent in values
|
||||
*
|
||||
* @param a the value to test against
|
||||
* @param b the value to test
|
||||
* @param [meta] an optional meta object that is passed through to all equality test calls
|
||||
* @returns are a and b equivalent in value
|
||||
*/
|
||||
function comparator(a, b, meta) {
|
||||
if (a === b) {
|
||||
return true;
|
||||
}
|
||||
if (a && b && typeof a === 'object' && typeof b === 'object') {
|
||||
if (isPlainObject(a) && isPlainObject(b)) {
|
||||
return areObjectsEqual(a, b, isEqual, meta);
|
||||
}
|
||||
var aShape = Array.isArray(a);
|
||||
var bShape = Array.isArray(b);
|
||||
if (aShape || bShape) {
|
||||
return aShape === bShape && areArraysEqual(a, b, isEqual, meta);
|
||||
}
|
||||
aShape = a instanceof Date;
|
||||
bShape = b instanceof Date;
|
||||
if (aShape || bShape) {
|
||||
return (aShape === bShape && sameValueZeroEqual(a.getTime(), b.getTime()));
|
||||
}
|
||||
aShape = a instanceof RegExp;
|
||||
bShape = b instanceof RegExp;
|
||||
if (aShape || bShape) {
|
||||
return aShape === bShape && areRegExpsEqual(a, b);
|
||||
}
|
||||
if (isPromiseLike(a) || isPromiseLike(b)) {
|
||||
return a === b;
|
||||
}
|
||||
if (HAS_MAP_SUPPORT) {
|
||||
aShape = a instanceof Map;
|
||||
bShape = b instanceof Map;
|
||||
if (aShape || bShape) {
|
||||
return aShape === bShape && areMapsEqual(a, b, isEqual, meta);
|
||||
}
|
||||
}
|
||||
if (HAS_SET_SUPPORT) {
|
||||
aShape = a instanceof Set;
|
||||
bShape = b instanceof Set;
|
||||
if (aShape || bShape) {
|
||||
return aShape === bShape && areSetsEqual(a, b, isEqual, meta);
|
||||
}
|
||||
}
|
||||
if (a.valueOf !== valueOf || b.valueOf !== valueOf) {
|
||||
return sameValueZeroEqual(a.valueOf(), b.valueOf());
|
||||
}
|
||||
return areObjectsEqual(a, b, isEqual, meta);
|
||||
}
|
||||
return a !== a && b !== b;
|
||||
}
|
||||
return comparator;
|
||||
}
|
||||
|
||||
var deepEqual = createComparator();
|
||||
var shallowEqual = createComparator(function () { return sameValueZeroEqual; });
|
||||
var circularDeepEqual = createComparator(createCircularEqualCreator());
|
||||
var circularShallowEqual = createComparator(createCircularEqualCreator(sameValueZeroEqual));
|
||||
|
||||
export { circularDeepEqual, circularShallowEqual, createComparator as createCustomEqual, deepEqual, sameValueZeroEqual, shallowEqual };
|
||||
//# sourceMappingURL=fast-equals.mjs.map
|
||||
1
node_modules/fast-equals/dist/fast-equals.mjs.map
generated
vendored
Normal file
1
node_modules/fast-equals/dist/fast-equals.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
26
node_modules/fast-equals/index.d.ts
generated
vendored
Normal file
26
node_modules/fast-equals/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
declare type EqualityComparator = (
|
||||
objectA: any,
|
||||
objectB: any,
|
||||
meta?: any,
|
||||
) => boolean;
|
||||
declare type InternalEqualityComparator = (
|
||||
objectA: any,
|
||||
objectB: any,
|
||||
indexOrKeyA: any,
|
||||
indexOrKeyB: any,
|
||||
parentA: any,
|
||||
parentB: any,
|
||||
meta: any,
|
||||
) => boolean;
|
||||
declare type EqualityComparatorCreator = (
|
||||
comparator: EqualityComparator,
|
||||
) => InternalEqualityComparator;
|
||||
|
||||
export declare function createCustomEqual(
|
||||
createIsEqual?: EqualityComparatorCreator,
|
||||
): EqualityComparator;
|
||||
export declare function circularDeepEqual<A, B>(objectA: A, objectB: B): boolean;
|
||||
export declare function circularShallowEqual<A, B>(objectA: A, objectB: B): boolean;
|
||||
export declare function deepEqual<A, B>(objectA: A, objectB: B): boolean;
|
||||
export declare function shallowEqual<A, B>(objectA: A, objectB: B): boolean;
|
||||
export declare function sameValueZeroEqual<A, B>(objectA: A, objectB: B): boolean;
|
||||
87
node_modules/fast-equals/package.json
generated
vendored
Normal file
87
node_modules/fast-equals/package.json
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"author": "tony_quetano@planttheidea.com",
|
||||
"browser": "dist/fast-equals.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/planttheidea/fast-equals/issues"
|
||||
},
|
||||
"description": "A blazing fast equality comparison, either shallow or deep",
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-node-resolve": "^13.1.3",
|
||||
"@types/jest": "^27.4.0",
|
||||
"@types/lodash": "^4.14.178",
|
||||
"@types/node": "^17.0.17",
|
||||
"@types/ramda": "^0.27.64",
|
||||
"@types/react": "^17.0.39",
|
||||
"@typescript-eslint/eslint-plugin": "^5.11.0",
|
||||
"@typescript-eslint/parser": "^5.11.0",
|
||||
"benchee": "^1.1.0",
|
||||
"cli-table3": "^0.6.1",
|
||||
"decircularize": "^1.0.0",
|
||||
"deep-eql": "^4.0.0",
|
||||
"deep-equal": "^2.0.5",
|
||||
"eslint": "^8.9.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-plugin-import": "^2.25.4",
|
||||
"eslint-plugin-jsx-a11y": "^6.5.1",
|
||||
"eslint-plugin-react": "^7.28.0",
|
||||
"eslint-webpack-plugin": "^3.1.1",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"fs-extra": "^10.0.0",
|
||||
"html-webpack-plugin": "^5.5.0",
|
||||
"in-publish": "^2.0.0",
|
||||
"jest": "^27.5.1",
|
||||
"lodash": "^4.17.21",
|
||||
"nano-equal": "^2.0.2",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-fast-compare": "^3.2.0",
|
||||
"release-it": "^14.12.4",
|
||||
"rollup": "^2.67.2",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"rollup-plugin-typescript2": "^0.31.2",
|
||||
"shallow-equal-fuzzy": "^0.0.2",
|
||||
"ts-jest": "^27.1.3",
|
||||
"ts-loader": "^9.2.6",
|
||||
"typescript": "^4.5.5",
|
||||
"underscore": "^1.13.2",
|
||||
"webpack": "^5.68.0",
|
||||
"webpack-cli": "^4.9.2",
|
||||
"webpack-dev-server": "^4.7.4"
|
||||
},
|
||||
"homepage": "https://github.com/planttheidea/fast-equals#readme",
|
||||
"keywords": [
|
||||
"fast",
|
||||
"equal",
|
||||
"equals",
|
||||
"deep-equal",
|
||||
"equivalent"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "dist/fast-equals.cjs.js",
|
||||
"module": "dist/fast-equals.esm.js",
|
||||
"name": "fast-equals",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/planttheidea/fast-equals.git"
|
||||
},
|
||||
"scripts": {
|
||||
"benchmark": "npm run dist && node benchmark/index.js",
|
||||
"build": "NODE_ENV=production rollup -c",
|
||||
"dev": "NODE_ENV=development webpack serve --progress --config=webpack/webpack.config.js",
|
||||
"dist": "rimraf dist && npm run build",
|
||||
"lint": "eslint src/*.ts",
|
||||
"lint:fix": "npm run lint -- --fix",
|
||||
"start": "npm run dev",
|
||||
"prepublish": "if in-publish; then npm run prepublish:compile; fi",
|
||||
"prepublish:compile": "npm run typecheck && npm run lint && npm run test && npm run dist",
|
||||
"release": "release-it",
|
||||
"release:beta": "release-it --config=.release-it.beta.json",
|
||||
"test": "NODE_PATH=. jest",
|
||||
"test:coverage": "npm test -- --coverage",
|
||||
"test:watch": "npm test -- --watch",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"types": "index.d.ts",
|
||||
"version": "3.0.3"
|
||||
}
|
||||
Reference in New Issue
Block a user