mirror of
https://github.com/musix-org/musix-oss
synced 2025-06-17 01:16:00 +00:00
Modules
This commit is contained in:
38
node_modules/deep-equal/.eslintrc
generated
vendored
Normal file
38
node_modules/deep-equal/.eslintrc
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"root": true,
|
||||
"extends": "@ljharb",
|
||||
"rules": {
|
||||
"complexity": 0,
|
||||
"eqeqeq": [2, "always", { "null": "ignore" }],
|
||||
"func-style": [2, "declaration"],
|
||||
"id-length": 0,
|
||||
"indent": [2, 2],
|
||||
"max-params": [2, 6],
|
||||
"max-statements-per-line": [2, { "max": 2 }],
|
||||
"new-cap": [2, { "capIsNewExceptions": ["GetIntrinsic"] }],
|
||||
"no-magic-numbers": [2, { "ignore": [0, 1] }],
|
||||
"operator-linebreak": [2, "before"],
|
||||
"strict": 1,
|
||||
},
|
||||
"globals": {
|
||||
"WeakMap": false,
|
||||
"WeakSet": false,
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": "example/**",
|
||||
"rules": {
|
||||
"no-console": 0,
|
||||
"no-magic-numbers": 0,
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": "test/**",
|
||||
"rules": {
|
||||
"max-params": 0,
|
||||
"no-magic-numbers": 0,
|
||||
"operator-linebreak": [2, "before"],
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
19
node_modules/deep-equal/.travis.yml
generated
vendored
Normal file
19
node_modules/deep-equal/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
version: ~> 1.0
|
||||
language: node_js
|
||||
os:
|
||||
- linux
|
||||
import:
|
||||
- ljharb/travis-ci:node/all.yml
|
||||
- ljharb/travis-ci:node/pretest.yml
|
||||
- ljharb/travis-ci:node/posttest.yml
|
||||
- ljharb/travis-ci:node/coverage.yml
|
||||
matrix:
|
||||
include:
|
||||
- node_js: "13"
|
||||
env: ASSERT=true TEST=true
|
||||
- node_js: "12"
|
||||
env: ASSERT=true TEST=true
|
||||
allow_failures:
|
||||
- env: COVERAGE=true
|
||||
- node_js: "10"
|
||||
env: ASSERT=true TEST=true
|
176
node_modules/deep-equal/CHANGELOG.md
generated
vendored
Normal file
176
node_modules/deep-equal/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,176 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
||||
|
||||
## [v2.0.1](https://github.com/inspect-js/node-deep-equal/compare/v2.0.0...v2.0.1) - 2019-12-09
|
||||
|
||||
### Fixed
|
||||
|
||||
- [Fix] `Map` and `Set` comparison: keys are loosely compared also [`#75`](https://github.com/inspect-js/node-deep-equal/issues/75)
|
||||
|
||||
### Commits
|
||||
|
||||
- [Fix] check extra properties on regexps [`1eac46b`](https://github.com/inspect-js/node-deep-equal/commit/1eac46b69c7b499cecb7e3b555b6e260de2043fd)
|
||||
- [Tests] update test skipping logic [`8adf08d`](https://github.com/inspect-js/node-deep-equal/commit/8adf08dcb91146590f2c57b614de6a853054f297)
|
||||
|
||||
## [v2.0.0](https://github.com/inspect-js/node-deep-equal/compare/v1.1.1...v2.0.0) - 2019-12-03
|
||||
|
||||
### Fixed
|
||||
|
||||
- [Fix] handle circular references [`#19`](https://github.com/inspect-js/node-deep-equal/issues/19)
|
||||
- [Breaking] compare `Map`, `Set`, `WeakMap`, `WeakSet` matching node assert [`#54`](https://github.com/inspect-js/node-deep-equal/issues/54) [`#46`](https://github.com/inspect-js/node-deep-equal/issues/46)
|
||||
- [Breaking] compare `Map`, `Set`, `WeakMap`, `WeakSet` matching node assert [`#54`](https://github.com/inspect-js/node-deep-equal/issues/54) [`#46`](https://github.com/inspect-js/node-deep-equal/issues/46)
|
||||
|
||||
### Commits
|
||||
|
||||
- [Tests] add passing tests from node core [`91a6472`](https://github.com/inspect-js/node-deep-equal/commit/91a6472719331eca1b13472db798e7f3188af9f7)
|
||||
- [Tests] convert remaining tests to use the custom assertion [`2bb7269`](https://github.com/inspect-js/node-deep-equal/commit/2bb7269013574a9a4e84ec5e34a04258f3ecd94a)
|
||||
- [Breaking] boxed primitives are not silently unboxed [`e207bc3`](https://github.com/inspect-js/node-deep-equal/commit/e207bc352f338a5c57b2ef2ce59d78b821fb2b58)
|
||||
- [Tests] run tests with assert, as well [`ccaf3ea`](https://github.com/inspect-js/node-deep-equal/commit/ccaf3eabb081d255f9fafcf2cc2631eafaa9b2a7)
|
||||
- [Refactor] use `side-channel` for memoizing circular refs [`983780a`](https://github.com/inspect-js/node-deep-equal/commit/983780aec338b8d909c3f6a5b1e0f4d7fe1d78b5)
|
||||
- [Tests] add `toStringTag` helper [`bb50ea2`](https://github.com/inspect-js/node-deep-equal/commit/bb50ea2e6d7906cd58683fdc7d327660e71612f4)
|
||||
- [readme] update URLs, readme [`9d300da`](https://github.com/inspect-js/node-deep-equal/commit/9d300da78ce21dcca7259bb557765cfac0db3e16)
|
||||
- [Tests] use `Buffer.from` when available [`43fa5da`](https://github.com/inspect-js/node-deep-equal/commit/43fa5dafe17b1287f56c2566c487a9c05946fe4f)
|
||||
- [Breaking] add `exports` to `package.json` [`ecd15ae`](https://github.com/inspect-js/node-deep-equal/commit/ecd15aedeeddc8f386ed8b54296648ee4a73af9b)
|
||||
- [Tests] require ASSERT tests to pass [`7ac77cf`](https://github.com/inspect-js/node-deep-equal/commit/7ac77cf21081b30eeadb5ac5201b30ad0d4dcbe4)
|
||||
- [Robustness] use `callBound` from `es-abstract` [`4dc3477`](https://github.com/inspect-js/node-deep-equal/commit/4dc347792be1f7131b3095ba98590a599cce7e20)
|
||||
- [patch] [[Prototype]]s are only compared in strict mode [`43b1eef`](https://github.com/inspect-js/node-deep-equal/commit/43b1eef2eb7bc3045fb160bf5d755bce44cbfd52)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `has-symbols` [`89228df`](https://github.com/inspect-js/node-deep-equal/commit/89228df447b174008e163f1c83c8f0f559e30fa0)
|
||||
- [Fix] pass options when comparing Collection keys/values [`9859584`](https://github.com/inspect-js/node-deep-equal/commit/9859584ae2f4f46ec602e18bac9610c71ff00e2f)
|
||||
- [Breaking] `false` and `[]` are no longer equal, even non-strictly [`5c3accc`](https://github.com/inspect-js/node-deep-equal/commit/5c3acccf541ba0b77342c2a441b32a43acebc73e)
|
||||
- [Tests] only use `Buffer.from` when it has a length of > 1 [`3645129`](https://github.com/inspect-js/node-deep-equal/commit/3645129d7692c5195ae4b94ba83d2fe84d9538d7)
|
||||
- [Breaking] remove `lib/is-arguments` and `lib/keys` entrypoints [`783d47e`](https://github.com/inspect-js/node-deep-equal/commit/783d47e3092b7a62aaecbf6836b18a0dfca96662)
|
||||
- [Dev Deps] update `eslint` [`7cc1dd9`](https://github.com/inspect-js/node-deep-equal/commit/7cc1dd986fc30946ca06ba6496ef856cfb911cf3)
|
||||
- Merge tag 'v1.1.1' [`f9d3c6d`](https://github.com/inspect-js/node-deep-equal/commit/f9d3c6d1e4a895c448ba7d8766f8616d0e235c9a)
|
||||
|
||||
## [v1.1.1](https://github.com/inspect-js/node-deep-equal/compare/v1.1.0...v1.1.1) - 2019-11-12
|
||||
|
||||
### Commits
|
||||
|
||||
- [Tests] use shared travis-ci configs [`678cb2a`](https://github.com/inspect-js/node-deep-equal/commit/678cb2a34ef920eab563af69bdf402b9273c3e2c)
|
||||
- [meta] add `auto-changelog` [`569bcce`](https://github.com/inspect-js/node-deep-equal/commit/569bcce030784f7506367055122c54c6cac00ebc)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`; add `safe-publish-latest` [`9dedd40`](https://github.com/inspect-js/node-deep-equal/commit/9dedd409cb74c538153287db546a14f2fa583e6f)
|
||||
- [Tests] up to `node` `v12.9` [`595c81a`](https://github.com/inspect-js/node-deep-equal/commit/595c81a2e2c1baab216b2dac640ed020f49033bf)
|
||||
- [Tests] add `npx aud` in `posttest` [`0b76639`](https://github.com/inspect-js/node-deep-equal/commit/0b766394504f74d002ad85e7b8244ce89bb27130)
|
||||
- [meta] add `funding` field [`3e519e3`](https://github.com/inspect-js/node-deep-equal/commit/3e519e36998ea82120cfe9a509dc0090a87d7063)
|
||||
- Merge tag 'v1.1.0' [`0aeca99`](https://github.com/inspect-js/node-deep-equal/commit/0aeca9988dba6fe3318f46c47c933e6926175278)
|
||||
|
||||
## [v1.1.0](https://github.com/inspect-js/node-deep-equal/compare/v1.0.1...v1.1.0) - 2019-08-28
|
||||
|
||||
### Fixed
|
||||
|
||||
- [Breaking] comparing arrays and objects should always fail, per node‘s assert.deepEqual [`#12`](https://github.com/inspect-js/node-deep-equal/issues/12)
|
||||
|
||||
### Commits
|
||||
|
||||
- [Tests] up to `node` `v12.7`, `v11.15`, `v10.16`, `v9.11`, `v8.16`, `v7.10`, `v6.17`, `4.9`; use `nvm install-latest-npm` [`ba11166`](https://github.com/inspect-js/node-deep-equal/commit/ba111664928f3a9279528dd05330b974950003b4)
|
||||
- [Tests] make a `tape` helper, to easily compare loose/strict, and (a,b)/(b,a) arg order [`0c25e94`](https://github.com/inspect-js/node-deep-equal/commit/0c25e9438b2d4a96e75c3c2e6fbb353ae450ed1f)
|
||||
- [Tests] add `npm run lint` [`8590816`](https://github.com/inspect-js/node-deep-equal/commit/8590816be6bc57a07fbc160985f5f04f11c7fa97)
|
||||
- test: Fails simple array tests on IE < 9 #10 [`bc37498`](https://github.com/inspect-js/node-deep-equal/commit/bc374988ee763a881ef39d8f6949838ec4df4e64)
|
||||
- [Tests] clean up/flesh out test cases [`3fffed9`](https://github.com/inspect-js/node-deep-equal/commit/3fffed9a7e095bbf922561fa0b18681422861af8)
|
||||
- [Fix] (array,arguments) now behaves the same as (arguments,array) [`a9528ff`](https://github.com/inspect-js/node-deep-equal/commit/a9528ff71561c303e722eb5ae0a3b9b2ecae4a3b)
|
||||
- [Refactor] move Date and RegExp tests into `objEquiv` [`5b3bf31`](https://github.com/inspect-js/node-deep-equal/commit/5b3bf315b603f00bab49e78c05c075cdc0dfd506)
|
||||
- [Fix] properly compare RegExp objects [`b8c179c`](https://github.com/inspect-js/node-deep-equal/commit/b8c179c5aa91c8a2f71f053e2d9e2d477780250e)
|
||||
- [Refactor] Use `object-keys` and `is-arguments` instead of a homegrown shim. [`3b503fb`](https://github.com/inspect-js/node-deep-equal/commit/3b503fb262c431df72a6c91cbb384be557315645)
|
||||
- [Fix] use `object-is` to support `NaN` and `-0` properly [`28fde4a`](https://github.com/inspect-js/node-deep-equal/commit/28fde4a411073e3131d3637248f8c25aac9329f2)
|
||||
- [Tests] add tests for getters, fake arrays, overriding getTime on Dates [`1b66d90`](https://github.com/inspect-js/node-deep-equal/commit/1b66d90232a5a576d0334f0c109f8c79da487c9f)
|
||||
- [Breaking] non-Date objects with different [[Prototypes]] are not equal [`5f2f2e5`](https://github.com/inspect-js/node-deep-equal/commit/5f2f2e55a3cfea251ca502a7846489a9133b4347)
|
||||
- [Breaking] boxed primitives are unwrapped for comparisons [`a159a3a`](https://github.com/inspect-js/node-deep-equal/commit/a159a3a0660a2da9a8ff6392aba4b2de81bc8391)
|
||||
- [meta] fix license text so GitHub can detect it [`7000403`](https://github.com/inspect-js/node-deep-equal/commit/700040347119ce46b3e917e800d87628af1384f9)
|
||||
- [Tests] Failing tests for Map equality [`4856185`](https://github.com/inspect-js/node-deep-equal/commit/4856185d989914e2f440fe3fd3bac4d977365fe2)
|
||||
- [Fix] robustly unbox boxed primitives, using `unbox-primitive` [`c455998`](https://github.com/inspect-js/node-deep-equal/commit/c45599893f02f349604a7b39b39f45036ea2e499)
|
||||
- [Tests] add array/object tests [`558eecf`](https://github.com/inspect-js/node-deep-equal/commit/558eecf9daa815468f0bc4c9799041507b7ffa15)
|
||||
- [Breaking] two objects with different `Symbol.toStringTag`s are not equal [`45431b6`](https://github.com/inspect-js/node-deep-equal/commit/45431b67b5e7e9cb91d5ff8706dc55348d59184e)
|
||||
- [Fix] ensure Buffer + non-Buffer comparison order does not matter [`de4e75c`](https://github.com/inspect-js/node-deep-equal/commit/de4e75ce7f0621cdc09ae8cbdc82de9e4c17578e)
|
||||
- [Tests] add more Error tests [`c0ae38c`](https://github.com/inspect-js/node-deep-equal/commit/c0ae38c43872621da83aba608cd62b951de7c4c6)
|
||||
- [Breaking] ensure `Error` objects compare properly [`ffb2522`](https://github.com/inspect-js/node-deep-equal/commit/ffb2522eb94afe46a8ccc23faebdcee23ea6f170)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`737031e`](https://github.com/inspect-js/node-deep-equal/commit/737031e9ac09812ec7181040e857d8b73b573970)
|
||||
- [Refactor] `objEquiv`: bail early if typeofs are different [`410e2d6`](https://github.com/inspect-js/node-deep-equal/commit/410e2d63730763e7e92c9b45b916f97058ab31f7)
|
||||
- [Tests] add tests for `Object.create(null)` [`ed266e8`](https://github.com/inspect-js/node-deep-equal/commit/ed266e8571d1efdbb4ece0a01f849cbc57461076)
|
||||
- [Refactor] there is no need to do further compareation when two types are not equal [`6a5efc1`](https://github.com/inspect-js/node-deep-equal/commit/6a5efc130e96398de55cf517969746c52735f34b)
|
||||
- Only apps should have lockfiles [`f60442f`](https://github.com/inspect-js/node-deep-equal/commit/f60442fa6fd10004366d80481ada7df668bd6adb)
|
||||
- [Tests] clean up redundant test [`cbbef21`](https://github.com/inspect-js/node-deep-equal/commit/cbbef21045e3b2e1ee30f6d0a83381d489df296e)
|
||||
- [Fix] use `is-date-object` to properly detect cross-realm Dates [`0c5b21a`](https://github.com/inspect-js/node-deep-equal/commit/0c5b21ad245d1427caefe20b2bace752cbe5e493)
|
||||
- [meta] Add copyright statements [`56a7746`](https://github.com/inspect-js/node-deep-equal/commit/56a774674f55bb3e0627aaec4dda90e4a06df7d6)
|
||||
- [Dev Deps] update `tape` [`3e9c1b9`](https://github.com/inspect-js/node-deep-equal/commit/3e9c1b903703e32bbed45fddcae815eb25822fd4)
|
||||
|
||||
## [v1.0.1](https://github.com/inspect-js/node-deep-equal/compare/v1.0.0...v1.0.1) - 2015-08-29
|
||||
|
||||
### Fixed
|
||||
|
||||
- Null should == undefined [`#23`](https://github.com/inspect-js/node-deep-equal/issues/23)
|
||||
|
||||
### Commits
|
||||
|
||||
- Update travis.yml to modern node [`5055802`](https://github.com/inspect-js/node-deep-equal/commit/5055802274a85a3e1493fa1b7378499554c6a4dc)
|
||||
|
||||
## [v1.0.0](https://github.com/inspect-js/node-deep-equal/compare/v0.2.2...v1.0.0) - 2015-02-07
|
||||
|
||||
## [v0.2.2](https://github.com/inspect-js/node-deep-equal/compare/v0.2.1...v0.2.2) - 2015-02-07
|
||||
|
||||
### Commits
|
||||
|
||||
- latest tape [`1d18617`](https://github.com/inspect-js/node-deep-equal/commit/1d18617608316a034c8ee6727838c9b82614f0f9)
|
||||
- add type check to support browsers [`3acb0d7`](https://github.com/inspect-js/node-deep-equal/commit/3acb0d7fb8915fb7f1ca97701b5761793738bad3)
|
||||
|
||||
## [v0.2.1](https://github.com/inspect-js/node-deep-equal/compare/v0.2.0...v0.2.1) - 2014-01-29
|
||||
|
||||
### Commits
|
||||
|
||||
- license file [`b3431d4`](https://github.com/inspect-js/node-deep-equal/commit/b3431d48e0f7c406a08d0e077f2dd9580d4561ae)
|
||||
|
||||
## [v0.2.0](https://github.com/inspect-js/node-deep-equal/compare/v0.1.2...v0.2.0) - 2014-01-29
|
||||
|
||||
### Commits
|
||||
|
||||
- buffer check without Buffer [`5271f39`](https://github.com/inspect-js/node-deep-equal/commit/5271f39f3ce61fecb71fa6ca28cb4a8a8b963bbd)
|
||||
- failing test for buffer comparison [`cc8990b`](https://github.com/inspect-js/node-deep-equal/commit/cc8990b9d84a2267d84253e21c9f7db238e961e9)
|
||||
|
||||
## [v0.1.2](https://github.com/inspect-js/node-deep-equal/compare/v0.1.1...v0.1.2) - 2013-12-21
|
||||
|
||||
### Commits
|
||||
|
||||
- test the arguments shim and properly factor out the arguments handling [`cf88b9c`](https://github.com/inspect-js/node-deep-equal/commit/cf88b9c2e87d6050ba1a46a82be216d0244ee428)
|
||||
- more coverage for the keys shim [`7a41f0e`](https://github.com/inspect-js/node-deep-equal/commit/7a41f0ec813616b0e1272c2bf463028a84d51c99)
|
||||
- test coverage for the non-object case [`abd3358`](https://github.com/inspect-js/node-deep-equal/commit/abd33586af0006e8492bbcdb1eb27a306359b03c)
|
||||
- fix the argument comparisons to properly call equal() [`0114a10`](https://github.com/inspect-js/node-deep-equal/commit/0114a10398e386ab0e073966e8525cd2ce125de4)
|
||||
- more code coverage for date comparisons [`41ac40e`](https://github.com/inspect-js/node-deep-equal/commit/41ac40e844b10833a75a39ea92e73bcdb1ae3cd9)
|
||||
- use the latest version of tape [`f8341cb`](https://github.com/inspect-js/node-deep-equal/commit/f8341cbff475ee7ee1ec651662cb5bd621c75838)
|
||||
- use https: for the badges [`514b332`](https://github.com/inspect-js/node-deep-equal/commit/514b332e9c2390c89c5beac8cf866c2f9a4afa9e)
|
||||
- 100% coverage [`e55aac7`](https://github.com/inspect-js/node-deep-equal/commit/e55aac78a6e013d6f5a10febc7009476a8f10ca5)
|
||||
|
||||
## [v0.1.1](https://github.com/inspect-js/node-deep-equal/compare/v0.1.0...v0.1.1) - 2013-12-20
|
||||
|
||||
### Commits
|
||||
|
||||
- Fixed arguments support for IE8- [`174d41a`](https://github.com/inspect-js/node-deep-equal/commit/174d41a5559820458648d237ebedfe78e44f7430)
|
||||
|
||||
## [v0.1.0](https://github.com/inspect-js/node-deep-equal/compare/v0.0.0...v0.1.0) - 2013-10-14
|
||||
|
||||
### Commits
|
||||
|
||||
- upgrade the markdown [`30e1f8f`](https://github.com/inspect-js/node-deep-equal/commit/30e1f8fe5b1fb7d5d68b156bf69bb04a7bb807a3)
|
||||
- opts.strict instead of a boolean arg [`58cbdb2`](https://github.com/inspect-js/node-deep-equal/commit/58cbdb2a97e623a68310833218af5ada6c97c2ce)
|
||||
- using testling-ci [`064af17`](https://github.com/inspect-js/node-deep-equal/commit/064af170f895fc67ec4bbf654e7de27721cf40c0)
|
||||
- Add optional strict parameter [`f3413b1`](https://github.com/inspect-js/node-deep-equal/commit/f3413b1d95e261f735939fbcaee65e598fe92852)
|
||||
- strict equality test [`281189b`](https://github.com/inspect-js/node-deep-equal/commit/281189b6962c9c57105474d01a8127da3318f555)
|
||||
- document opts.strict [`69fae5a`](https://github.com/inspect-js/node-deep-equal/commit/69fae5ab4b9278e28d09864c62dcfe9b4f00c1d8)
|
||||
- using tape [`4384db8`](https://github.com/inspect-js/node-deep-equal/commit/4384db8a9cc7af1cf79e1976d1b36e66934b2b4c)
|
||||
- using travis [`e508692`](https://github.com/inspect-js/node-deep-equal/commit/e5086928e1edf120d227d5e7f5e6ac4d755248a1)
|
||||
- deepEquals comparing nulls seems to break in ie6-8 [`b2cfeb9`](https://github.com/inspect-js/node-deep-equal/commit/b2cfeb95da6982f8bc2e676231820a3a47385db3)
|
||||
- performance note in the readme [`da9bfc9`](https://github.com/inspect-js/node-deep-equal/commit/da9bfc9aadfb9045bbf8157e9403de7184b404fd)
|
||||
- more firefoxes [`3d60ec5`](https://github.com/inspect-js/node-deep-equal/commit/3d60ec58d6fe269c13c5be04b749f01972aa5b1c)
|
||||
|
||||
## v0.0.0 - 2012-02-11
|
||||
|
||||
### Commits
|
||||
|
||||
- implementation with an example [`2dd56f9`](https://github.com/inspect-js/node-deep-equal/commit/2dd56f9e6d42e841c74289c2e2d489047d077622)
|
||||
- readme [`4a44f99`](https://github.com/inspect-js/node-deep-equal/commit/4a44f99bea3277e32d9842d9d49ac21f316ac74d)
|
||||
- and a test [`357ccd3`](https://github.com/inspect-js/node-deep-equal/commit/357ccd37d23ba7814c8fe284d36d6e86a39b7526)
|
||||
- actually just MIT [`3d348c8`](https://github.com/inspect-js/node-deep-equal/commit/3d348c88fc92ce1d69a3fedbb2aa8cb6ea1480f7)
|
21
node_modules/deep-equal/LICENSE
generated
vendored
Normal file
21
node_modules/deep-equal/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2012, 2013, 2014 James Halliday <mail@substack.net>, 2009 Thomas Robinson <280north.com>
|
||||
|
||||
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.
|
1
node_modules/deep-equal/assert.js
generated
vendored
Normal file
1
node_modules/deep-equal/assert.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require('assert');
|
11
node_modules/deep-equal/example/cmp.js
generated
vendored
Normal file
11
node_modules/deep-equal/example/cmp.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
var equal = require('../');
|
||||
console.dir([
|
||||
equal(
|
||||
{ a: [2, 3], b: [4] },
|
||||
{ a: [2, 3], b: [4] }
|
||||
),
|
||||
equal(
|
||||
{ x: 5, y: [6] },
|
||||
{ x: 5, y: 6 }
|
||||
)
|
||||
]);
|
358
node_modules/deep-equal/index.js
generated
vendored
Normal file
358
node_modules/deep-equal/index.js
generated
vendored
Normal file
@ -0,0 +1,358 @@
|
||||
var objectKeys = require('object-keys');
|
||||
var isArguments = require('is-arguments');
|
||||
var is = require('object-is');
|
||||
var isRegex = require('is-regex');
|
||||
var flags = require('regexp.prototype.flags');
|
||||
var isArray = require('isarray');
|
||||
var isDate = require('is-date-object');
|
||||
var whichBoxedPrimitive = require('which-boxed-primitive');
|
||||
var GetIntrinsic = require('es-abstract/GetIntrinsic');
|
||||
var callBound = require('es-abstract/helpers/callBound');
|
||||
var whichCollection = require('which-collection');
|
||||
var getIterator = require('es-get-iterator');
|
||||
var getSideChannel = require('side-channel');
|
||||
|
||||
var $getTime = callBound('Date.prototype.getTime');
|
||||
var gPO = Object.getPrototypeOf;
|
||||
var $objToString = callBound('Object.prototype.toString');
|
||||
|
||||
var $Set = GetIntrinsic('%Set%', true);
|
||||
var $mapHas = callBound('Map.prototype.has', true);
|
||||
var $mapGet = callBound('Map.prototype.get', true);
|
||||
var $mapSize = callBound('Map.prototype.size', true);
|
||||
var $setAdd = callBound('Set.prototype.add', true);
|
||||
var $setDelete = callBound('Set.prototype.delete', true);
|
||||
var $setHas = callBound('Set.prototype.has', true);
|
||||
var $setSize = callBound('Set.prototype.size', true);
|
||||
|
||||
// taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L401-L414
|
||||
function setHasEqualElement(set, val1, strict, channel) {
|
||||
var i = getIterator(set);
|
||||
var result;
|
||||
while ((result = i.next()) && !result.done) {
|
||||
if (internalDeepEqual(val1, result.value, strict, channel)) { // eslint-disable-line no-use-before-define
|
||||
// Remove the matching element to make sure we do not check that again.
|
||||
$setDelete(set, result.value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L416-L439
|
||||
function findLooseMatchingPrimitives(prim) {
|
||||
if (typeof prim === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
if (typeof prim === 'object') { // Only pass in null as object!
|
||||
return void 0;
|
||||
}
|
||||
if (typeof prim === 'symbol') {
|
||||
return false;
|
||||
}
|
||||
if (typeof prim === 'string' || typeof prim === 'number') {
|
||||
// Loose equal entries exist only if the string is possible to convert to a regular number and not NaN.
|
||||
return +prim === +prim; // eslint-disable-line no-implicit-coercion
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L449-L460
|
||||
function mapMightHaveLoosePrim(a, b, prim, item, channel) {
|
||||
var altValue = findLooseMatchingPrimitives(prim);
|
||||
if (altValue != null) {
|
||||
return altValue;
|
||||
}
|
||||
var curB = $mapGet(b, altValue);
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
if ((typeof curB === 'undefined' && !$mapHas(b, altValue)) || !internalDeepEqual(item, curB, false, channel)) {
|
||||
return false;
|
||||
}
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
return !$mapHas(a, altValue) && internalDeepEqual(item, curB, false, channel);
|
||||
}
|
||||
|
||||
// taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L441-L447
|
||||
function setMightHaveLoosePrim(a, b, prim) {
|
||||
var altValue = findLooseMatchingPrimitives(prim);
|
||||
if (altValue != null) {
|
||||
return altValue;
|
||||
}
|
||||
|
||||
return $setHas(b, altValue) && !$setHas(a, altValue);
|
||||
}
|
||||
|
||||
// taken from https://github.com/browserify/commonjs-assert/blob/bba838e9ba9e28edf3127ce6974624208502f6bc/internal/util/comparisons.js#L518-L533
|
||||
function mapHasEqualEntry(set, map, key1, item1, strict, channel) {
|
||||
var i = getIterator(set);
|
||||
var result;
|
||||
var key2;
|
||||
while ((result = i.next()) && !result.done) {
|
||||
key2 = result.value;
|
||||
if (
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
internalDeepEqual(key1, key2, strict, channel)
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
&& internalDeepEqual(item1, $mapGet(map, key2), strict, channel)
|
||||
) {
|
||||
$setDelete(set, key2);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function internalDeepEqual(actual, expected, options, channel) {
|
||||
var opts = options || {};
|
||||
|
||||
// 7.1. All identical values are equivalent, as determined by ===.
|
||||
if (opts.strict ? is(actual, expected) : actual === expected) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var actualBoxed = whichBoxedPrimitive(actual);
|
||||
var expectedBoxed = whichBoxedPrimitive(expected);
|
||||
if (actualBoxed !== expectedBoxed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 7.3. Other pairs that do not both pass typeof value == 'object', equivalence is determined by ==.
|
||||
if (!actual || !expected || (typeof actual !== 'object' && typeof expected !== 'object')) {
|
||||
if ((actual === false && expected) || (actual && expected === false)) { return false; }
|
||||
return opts.strict ? is(actual, expected) : actual == expected; // eslint-disable-line eqeqeq
|
||||
}
|
||||
|
||||
/*
|
||||
* 7.4. For all other Object pairs, including Array objects, equivalence is
|
||||
* determined by having the same number of owned properties (as verified
|
||||
* with Object.prototype.hasOwnProperty.call), the same set of keys
|
||||
* (although not necessarily the same order), equivalent values for every
|
||||
* corresponding key, and an identical 'prototype' property. Note: this
|
||||
* accounts for both named and indexed properties on Arrays.
|
||||
*/
|
||||
// see https://github.com/nodejs/node/commit/d3aafd02efd3a403d646a3044adcf14e63a88d32 for memos/channel inspiration
|
||||
|
||||
var hasActual = channel.has(actual);
|
||||
var hasExpected = channel.has(expected);
|
||||
var sentinel;
|
||||
if (hasActual && hasExpected) {
|
||||
if (channel.get(actual) === channel.get(expected)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
sentinel = {};
|
||||
}
|
||||
if (!hasActual) { channel.set(actual, sentinel); }
|
||||
if (!hasExpected) { channel.set(expected, sentinel); }
|
||||
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
return objEquiv(actual, expected, opts, channel);
|
||||
}
|
||||
|
||||
function isBuffer(x) {
|
||||
if (!x || typeof x !== 'object' || typeof x.length !== 'number') {
|
||||
return false;
|
||||
}
|
||||
if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {
|
||||
return false;
|
||||
}
|
||||
if (x.length > 0 && typeof x[0] !== 'number') {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function setEquiv(a, b, opts, channel) {
|
||||
if ($setSize(a) !== $setSize(b)) {
|
||||
return false;
|
||||
}
|
||||
var iA = getIterator(a);
|
||||
var iB = getIterator(b);
|
||||
var resultA;
|
||||
var resultB;
|
||||
var set;
|
||||
while ((resultA = iA.next()) && !resultA.done) {
|
||||
if (resultA.value && typeof resultA.value === 'object') {
|
||||
if (!set) { set = new $Set(); }
|
||||
$setAdd(set, resultA.value);
|
||||
} else if (!$setHas(b, resultA.value)) {
|
||||
if (opts.strict) { return false; }
|
||||
if (!setMightHaveLoosePrim(a, b, resultA.value)) {
|
||||
return false;
|
||||
}
|
||||
if (!set) { set = new $Set(); }
|
||||
$setAdd(set, resultA.value);
|
||||
}
|
||||
}
|
||||
if (set) {
|
||||
while ((resultB = iB.next()) && !resultB.done) {
|
||||
// We have to check if a primitive value is already matching and only if it's not, go hunting for it.
|
||||
if (resultB.value && typeof resultB.value === 'object') {
|
||||
if (!setHasEqualElement(set, resultB.value, opts.strict, channel)) {
|
||||
return false;
|
||||
}
|
||||
} else if (
|
||||
!opts.strict
|
||||
&& !$setHas(a, resultB.value)
|
||||
&& !setHasEqualElement(set, resultB.value, opts.strict, channel)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $setSize(set) === 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function mapEquiv(a, b, opts, channel) {
|
||||
if ($mapSize(a) !== $mapSize(b)) {
|
||||
return false;
|
||||
}
|
||||
var iA = getIterator(a);
|
||||
var iB = getIterator(b);
|
||||
var resultA;
|
||||
var resultB;
|
||||
var set;
|
||||
var key;
|
||||
var item1;
|
||||
var item2;
|
||||
while ((resultA = iA.next()) && !resultA.done) {
|
||||
key = resultA.value[0];
|
||||
item1 = resultA.value[1];
|
||||
if (key && typeof key === 'object') {
|
||||
if (!set) { set = new $Set(); }
|
||||
$setAdd(set, key);
|
||||
} else {
|
||||
item2 = $mapGet(b, key);
|
||||
// if (typeof curB === 'undefined' && !$mapHas(b, altValue) || !internalDeepEqual(item, curB, false, channel)) {
|
||||
if ((typeof item2 === 'undefined' && !$mapHas(b, key)) || !internalDeepEqual(item1, item2, opts.strict, channel)) {
|
||||
if (opts.strict) {
|
||||
return false;
|
||||
}
|
||||
if (!mapMightHaveLoosePrim(a, b, key, item1, channel)) {
|
||||
return false;
|
||||
}
|
||||
if (!set) { set = new $Set(); }
|
||||
$setAdd(set, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (set) {
|
||||
while ((resultB = iB.next()) && !resultB.done) {
|
||||
key = resultB.value[0];
|
||||
item1 = resultB.value[1];
|
||||
if (key && typeof key === 'object') {
|
||||
if (!mapHasEqualEntry(set, a, key, item1, opts.strict, channel)) {
|
||||
return false;
|
||||
}
|
||||
} else if (
|
||||
!opts.strict
|
||||
&& (!a.has(key) || !internalDeepEqual($mapGet(a, key), item1, false, channel))
|
||||
&& !mapHasEqualEntry(set, a, key, item1, false, channel)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $setSize(set) === 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function objEquiv(a, b, opts, channel) {
|
||||
/* eslint max-statements: [2, 100], max-lines-per-function: [2, 120], max-depth: [2, 5] */
|
||||
var i, key;
|
||||
|
||||
if (typeof a !== typeof b) { return false; }
|
||||
if (a == null || b == null) { return false; }
|
||||
|
||||
// an identical 'prototype' property.
|
||||
if (a.prototype !== b.prototype) { return false; }
|
||||
|
||||
if ($objToString(a) !== $objToString(b)) { return false; }
|
||||
|
||||
if (isArguments(a) !== isArguments(b)) { return false; }
|
||||
|
||||
var aIsArray = isArray(a);
|
||||
var bIsArray = isArray(b);
|
||||
if (aIsArray !== bIsArray) { return false; }
|
||||
|
||||
// TODO: replace when a cross-realm brand check is available
|
||||
var aIsError = a instanceof Error;
|
||||
var bIsError = b instanceof Error;
|
||||
if (aIsError !== bIsError) { return false; }
|
||||
if (aIsError || bIsError) {
|
||||
if (a.name !== b.name || a.message !== b.message) { return false; }
|
||||
}
|
||||
|
||||
var aIsRegex = isRegex(a);
|
||||
var bIsRegex = isRegex(b);
|
||||
if (aIsRegex !== bIsRegex) { return false; }
|
||||
if ((aIsRegex || bIsRegex) && (a.source !== b.source || flags(a) !== flags(b))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var aIsDate = isDate(a);
|
||||
var bIsDate = isDate(b);
|
||||
if (aIsDate !== bIsDate) { return false; }
|
||||
if (aIsDate || bIsDate) { // && would work too, because both are true or both false here
|
||||
if ($getTime(a) !== $getTime(b)) { return false; }
|
||||
}
|
||||
if (opts.strict && gPO && gPO(a) !== gPO(b)) { return false; }
|
||||
|
||||
var aIsBuffer = isBuffer(a);
|
||||
var bIsBuffer = isBuffer(b);
|
||||
if (aIsBuffer !== bIsBuffer) { return false; }
|
||||
if (aIsBuffer || bIsBuffer) { // && would work too, because both are true or both false here
|
||||
if (a.length !== b.length) { return false; }
|
||||
for (i = 0; i < a.length; i++) {
|
||||
if (a[i] !== b[i]) { return false; }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (typeof a !== typeof b) { return false; }
|
||||
|
||||
try {
|
||||
var ka = objectKeys(a);
|
||||
var kb = objectKeys(b);
|
||||
} catch (e) { // happens when one is a string literal and the other isn't
|
||||
return false;
|
||||
}
|
||||
// having the same number of owned properties (keys incorporates hasOwnProperty)
|
||||
if (ka.length !== kb.length) { return false; }
|
||||
|
||||
// the same set of keys (although not necessarily the same order),
|
||||
ka.sort();
|
||||
kb.sort();
|
||||
// ~~~cheap key test
|
||||
for (i = ka.length - 1; i >= 0; i--) {
|
||||
if (ka[i] != kb[i]) { return false; } // eslint-disable-line eqeqeq
|
||||
}
|
||||
|
||||
// equivalent values for every corresponding key, and ~~~possibly expensive deep test
|
||||
for (i = ka.length - 1; i >= 0; i--) {
|
||||
key = ka[i];
|
||||
if (!internalDeepEqual(a[key], b[key], opts, channel)) { return false; }
|
||||
}
|
||||
|
||||
var aCollection = whichCollection(a);
|
||||
var bCollection = whichCollection(b);
|
||||
if (aCollection !== bCollection) {
|
||||
return false;
|
||||
}
|
||||
if (aCollection === 'Set' || bCollection === 'Set') { // aCollection === bCollection
|
||||
return setEquiv(a, b, opts, channel);
|
||||
}
|
||||
if (aCollection === 'Map') { // aCollection === bCollection
|
||||
return mapEquiv(a, b, opts, channel);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = function deepEqual(a, b, opts) {
|
||||
return internalDeepEqual(a, b, opts, getSideChannel());
|
||||
};
|
151
node_modules/deep-equal/package.json
generated
vendored
Normal file
151
node_modules/deep-equal/package.json
generated
vendored
Normal file
@ -0,0 +1,151 @@
|
||||
{
|
||||
"_from": "deep-equal@^2.0.0",
|
||||
"_id": "deep-equal@2.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-7Et6r6XfNW61CPPCIYfm1YPGSmh6+CliYeL4km7GWJcpX5LTAflGF8drLLR+MZX+2P3NZfAfSduutBbSWqER4g==",
|
||||
"_location": "/deep-equal",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "deep-equal@^2.0.0",
|
||||
"name": "deep-equal",
|
||||
"escapedName": "deep-equal",
|
||||
"rawSpec": "^2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@google-cloud/firestore"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.0.1.tgz",
|
||||
"_shasum": "fc12bbd6850e93212f21344748682ccc5a8813cf",
|
||||
"_spec": "deep-equal@^2.0.0",
|
||||
"_where": "C:\\Users\\matia\\Documents\\GitHub\\Musix\\node_modules\\@google-cloud\\firestore",
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false
|
||||
},
|
||||
"browser": {
|
||||
"assert.js": false
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/inspect-js/node-deep-equal/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "https://substack.net"
|
||||
},
|
||||
{
|
||||
"name": "Jordan Harband",
|
||||
"email": "ljharb@gmail.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"es-abstract": "^1.16.3",
|
||||
"es-get-iterator": "^1.0.1",
|
||||
"is-arguments": "^1.0.4",
|
||||
"is-date-object": "^1.0.1",
|
||||
"is-regex": "^1.0.4",
|
||||
"isarray": "^2.0.5",
|
||||
"object-is": "^1.0.1",
|
||||
"object-keys": "^1.1.1",
|
||||
"regexp.prototype.flags": "^1.2.0",
|
||||
"side-channel": "^1.0.1",
|
||||
"which-boxed-primitive": "^1.0.1",
|
||||
"which-collection": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "node's assert.deepEqual algorithm",
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^15.0.2",
|
||||
"auto-changelog": "^1.16.2",
|
||||
"eslint": "^6.7.2",
|
||||
"has-symbols": "^1.0.1",
|
||||
"has-typed-arrays": "^1.0.0",
|
||||
"object.assign": "^4.1.0",
|
||||
"object.getownpropertydescriptors": "^2.0.3",
|
||||
"safe-publish-latest": "^1.1.4",
|
||||
"semver": "^6.3.0",
|
||||
"tape": "^4.11.0"
|
||||
},
|
||||
"directories": {
|
||||
"lib": ".",
|
||||
"example": "example",
|
||||
"test": "test"
|
||||
},
|
||||
"exports": {
|
||||
".": [
|
||||
{
|
||||
"default": "./index.js"
|
||||
},
|
||||
"./index.js"
|
||||
],
|
||||
"./package": "./package.json",
|
||||
"./package.json": "./package"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"homepage": "https://github.com/inspect-js/node-deep-equal#readme",
|
||||
"keywords": [
|
||||
"equality",
|
||||
"equal",
|
||||
"compare"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "deep-equal",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/inspect-js/node-deep-equal.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"posttest": "npx aud",
|
||||
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"",
|
||||
"prepublish": "safe-publish-latest",
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run tests-only",
|
||||
"tests-only": "tape test/*",
|
||||
"version": "auto-changelog && git add CHANGELOG.md"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/*.js",
|
||||
"browsers": {
|
||||
"ie": [
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9
|
||||
],
|
||||
"ff": [
|
||||
3.5,
|
||||
10,
|
||||
15
|
||||
],
|
||||
"chrome": [
|
||||
10,
|
||||
22
|
||||
],
|
||||
"safari": [
|
||||
5.1
|
||||
],
|
||||
"opera": [
|
||||
12
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": "2.0.1"
|
||||
}
|
54
node_modules/deep-equal/readme.markdown
generated
vendored
Normal file
54
node_modules/deep-equal/readme.markdown
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
# deep-equal
|
||||
|
||||
Node's `assert.deepEqual() algorithm` as a standalone module.
|
||||
|
||||
This module is around [46 times faster](https://gist.github.com/substack/2790507#gistcomment-3099862) than wrapping `assert.deepEqual()` in a `try/catch`.
|
||||
|
||||
[](https://travis-ci.org/inspect-js/node-deep-equal)
|
||||
|
||||
# example
|
||||
|
||||
``` js
|
||||
var equal = require('deep-equal');
|
||||
console.dir([
|
||||
equal(
|
||||
{ a : [ 2, 3 ], b : [ 4 ] },
|
||||
{ a : [ 2, 3 ], b : [ 4 ] }
|
||||
),
|
||||
equal(
|
||||
{ x : 5, y : [6] },
|
||||
{ x : 5, y : 6 }
|
||||
)
|
||||
]);
|
||||
```
|
||||
|
||||
# methods
|
||||
|
||||
``` js
|
||||
var deepEqual = require('deep-equal')
|
||||
```
|
||||
|
||||
## deepEqual(a, b, opts)
|
||||
|
||||
Compare objects `a` and `b`, returning whether they are equal according to a
|
||||
recursive equality algorithm.
|
||||
|
||||
If `opts.strict` is `true`, use strict equality (`===`) to compare leaf nodes.
|
||||
The default is to use coercive equality (`==`) because that's how
|
||||
`assert.deepEqual()` works by default.
|
||||
|
||||
# install
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```
|
||||
npm install deep-equal
|
||||
```
|
||||
|
||||
# test
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```
|
||||
npm test
|
||||
```
|
40
node_modules/deep-equal/test/_tape.js
generated
vendored
Normal file
40
node_modules/deep-equal/test/_tape.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
var Test = require('tape/lib/test');
|
||||
var is = require('object-is');
|
||||
|
||||
var deepEqual = require('../');
|
||||
var assert = require('../assert');
|
||||
|
||||
var equal = process.env.ASSERT ? function assertDeepEqual(a, b, options) {
|
||||
try {
|
||||
if (options && options.strict) {
|
||||
assert.deepStrictEqual(a, b);
|
||||
} else {
|
||||
assert.deepEqual(a, b);
|
||||
}
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} : deepEqual;
|
||||
|
||||
function equalReversed(t, a, b, isEqual, msg, isStrict, skipReversed) {
|
||||
var actual = isStrict
|
||||
? equal(a, b, { strict: true })
|
||||
: equal(a, b);
|
||||
var suffix = isEqual ? ' are equal' : ' are not equal';
|
||||
t.equal(actual, !!isEqual, msg + suffix);
|
||||
if (typeof skipReversed === 'boolean' ? !skipReversed : !is(a, b)) {
|
||||
var actualReverse = isStrict
|
||||
? equal(b, a, { strict: true })
|
||||
: equal(b, a);
|
||||
t.equal(actualReverse, !!isEqual, msg + suffix + ' (reversed)');
|
||||
}
|
||||
}
|
||||
function deepEqualTest(t, a, b, msg, isEqual, isStrictEqual, skipReversed) {
|
||||
equalReversed(t, a, b, isEqual, msg, false, skipReversed);
|
||||
equalReversed(t, a, b, isStrictEqual, 'strict: ' + msg, true, skipReversed);
|
||||
}
|
||||
|
||||
Test.prototype.deepEqualTest = function (a, b, message, isEqual, isStrictEqual, skipReversed) {
|
||||
return deepEqualTest(this, a, b, message, !!isEqual, !!isStrictEqual, skipReversed);
|
||||
};
|
834
node_modules/deep-equal/test/cmp.js
generated
vendored
Normal file
834
node_modules/deep-equal/test/cmp.js
generated
vendored
Normal file
@ -0,0 +1,834 @@
|
||||
var test = require('tape');
|
||||
require('./_tape');
|
||||
var assign = require('object.assign');
|
||||
var gOPDs = require('object.getownpropertydescriptors');
|
||||
var hasSymbols = require('has-symbols')();
|
||||
var hasTypedArrays = require('has-typed-arrays')();
|
||||
var semver = require('semver');
|
||||
|
||||
var safeBuffer = typeof Buffer === 'function' ? Buffer.from && Buffer.from.length > 1 ? Buffer.from : Buffer : null;
|
||||
|
||||
var isNode = typeof process === 'object' && typeof process.version === 'string';
|
||||
|
||||
function tag(obj, value) {
|
||||
if (hasSymbols && Symbol.toStringTags && Object.defineProperty) {
|
||||
Object.defineProperty(obj, Symbol.toStringTag, {
|
||||
value: value
|
||||
});
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-proto
|
||||
var hasDunderProto = [].__proto__ === Array.prototype;
|
||||
|
||||
test('equal', function (t) {
|
||||
t.deepEqualTest(
|
||||
{ a: [2, 3], b: [4] },
|
||||
{ a: [2, 3], b: [4] },
|
||||
'two equal objects',
|
||||
true,
|
||||
true,
|
||||
false
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Maps', { skip: typeof Map !== 'function' }, function (t) {
|
||||
t.deepEqualTest(
|
||||
new Map([['a', 1], ['b', 2]]),
|
||||
new Map([['b', 2], ['a', 1]]),
|
||||
'two equal Maps',
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
t.deepEqualTest(
|
||||
new Map([['a', [1, 2]]]),
|
||||
new Map([['a', [2, 1]]]),
|
||||
'two Maps with inequal values on the same key',
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
t.deepEqualTest(
|
||||
new Map([['a', 1]]),
|
||||
new Map([['b', 1]]),
|
||||
'two inequal Maps',
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
t.deepEqualTest(
|
||||
new Map([[{}, 1], [{}, 2], [{}, 1]]),
|
||||
new Map([[{}, 1], [{}, 2], [{}, 1]]),
|
||||
'two equal Maps in different orders',
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('WeakMaps', { skip: typeof WeakMap !== 'function' }, function (t) {
|
||||
t.deepEqualTest(
|
||||
new WeakMap([[Object, null], [Function, true]]),
|
||||
new WeakMap([[Function, true], [Object, null]]),
|
||||
'two equal WeakMaps',
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
t.deepEqualTest(
|
||||
new WeakMap([[Object, null]]),
|
||||
new WeakMap([[Object, true]]),
|
||||
'two WeakMaps with inequal values on the same key',
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
t.deepEqualTest(
|
||||
new WeakMap([[Object, null], [Function, true]]),
|
||||
new WeakMap([[Object, null]]),
|
||||
'two inequal WeakMaps',
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Sets', { skip: typeof Set !== 'function' }, function (t) {
|
||||
t.deepEqualTest(
|
||||
new Set(['a', 1, 'b', 2]),
|
||||
new Set(['b', 2, 'a', 1]),
|
||||
'two equal Sets',
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
t.deepEqualTest(
|
||||
new Set(['a', 1]),
|
||||
new Set(['b', 1]),
|
||||
'two inequal Sets',
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
t.deepEqualTest(
|
||||
new Set([{}, 1, {}, {}, 2]),
|
||||
new Set([{}, 1, {}, 2, {}]),
|
||||
'two equal Sets in different orders',
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('WeakSets', { skip: typeof WeakSet !== 'function' }, function (t) {
|
||||
t.deepEqualTest(
|
||||
new WeakSet([Object, Function]),
|
||||
new WeakSet([Function, Object]),
|
||||
'two equal WeakSets',
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
t.deepEqualTest(
|
||||
new WeakSet([Object, Function]),
|
||||
new WeakSet([Object]),
|
||||
'two inequal WeakSets',
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('not equal', function (t) {
|
||||
t.deepEqualTest(
|
||||
{ x: 5, y: [6] },
|
||||
{ x: 5, y: 6 },
|
||||
'two inequal objects are',
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('nested nulls', function (t) {
|
||||
t.deepEqualTest(
|
||||
[null, null, null],
|
||||
[null, null, null],
|
||||
'same-length arrays of nulls',
|
||||
true,
|
||||
true,
|
||||
true
|
||||
);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('objects with strings vs numbers', function (t) {
|
||||
t.deepEqualTest(
|
||||
[{ a: 3 }, { b: 4 }],
|
||||
[{ a: '3' }, { b: '4' }],
|
||||
'objects with equivalent string/number values',
|
||||
true,
|
||||
false
|
||||
);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('non-objects', function (t) {
|
||||
t.deepEqualTest(3, 3, 'same numbers', true, true, true);
|
||||
t.deepEqualTest('beep', 'beep', 'same strings', true, true, true);
|
||||
t.deepEqualTest('3', 3, 'numeric string and number', true, false);
|
||||
t.deepEqualTest('3', [3], 'numeric string and array containing number', false, false);
|
||||
t.deepEqualTest(3, [3], 'number and array containing number', false, false);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('infinities', function (t) {
|
||||
t.deepEqualTest(Infinity, Infinity, '∞ and ∞', true, true, true);
|
||||
t.deepEqualTest(-Infinity, -Infinity, '-∞ and -∞', true, true, true);
|
||||
t.deepEqualTest(Infinity, -Infinity, '∞ and -∞', false, false);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('arguments class', function (t) {
|
||||
function getArgs() {
|
||||
return arguments;
|
||||
}
|
||||
|
||||
t.deepEqualTest(
|
||||
getArgs(1, 2, 3),
|
||||
getArgs(1, 2, 3),
|
||||
'equivalent arguments objects are equal',
|
||||
true,
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
t.deepEqualTest(
|
||||
getArgs(1, 2, 3),
|
||||
[1, 2, 3],
|
||||
'array and arguments with same contents',
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Dates', function (t) {
|
||||
var d0 = new Date(1387585278000);
|
||||
var d1 = new Date('Fri Dec 20 2013 16:21:18 GMT-0800 (PST)');
|
||||
|
||||
t.deepEqualTest(d0, d1, 'two Dates with the same timestamp', true, true);
|
||||
|
||||
d1.a = true;
|
||||
|
||||
t.deepEqualTest(d0, d1, 'two Dates with the same timestamp but different own properties', false, false);
|
||||
|
||||
t.test('overriding `getTime`', { skip: !Object.defineProperty }, function (st) {
|
||||
var a = new Date('2000');
|
||||
var b = new Date('2000');
|
||||
Object.defineProperty(a, 'getTime', { value: function () { return 5; } });
|
||||
st.deepEqualTest(a, b, 'two Dates with the same timestamp but one has overridden `getTime`', true, true);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('fake Date', { skip: !hasDunderProto }, function (st) {
|
||||
var a = new Date(2000);
|
||||
var b = tag(Object.create(
|
||||
a.__proto__, // eslint-disable-line no-proto
|
||||
gOPDs(a)
|
||||
), 'Date');
|
||||
|
||||
st.deepEqualTest(
|
||||
a,
|
||||
b,
|
||||
'Date, and fake Date',
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
var a = new Date('2000');
|
||||
var b = new Date('2000');
|
||||
b.foo = true;
|
||||
t.deepEqualTest(
|
||||
a,
|
||||
b,
|
||||
'two identical Dates, one with an extra property',
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('buffers', { skip: typeof Buffer !== 'function' }, function (t) {
|
||||
/* eslint no-buffer-constructor: 1, new-cap: 1 */
|
||||
t.deepEqualTest(
|
||||
safeBuffer('xyz'),
|
||||
safeBuffer('xyz'),
|
||||
'buffers with same contents are equal',
|
||||
true,
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
t.deepEqualTest(
|
||||
safeBuffer('abc'),
|
||||
safeBuffer('xyz'),
|
||||
'buffers with different contents',
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
t.deepEqualTest(
|
||||
safeBuffer(''),
|
||||
[],
|
||||
'empty buffer and empty array',
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Arrays', function (t) {
|
||||
var a = [];
|
||||
var b = [];
|
||||
b.foo = true;
|
||||
|
||||
t.deepEqualTest(
|
||||
a,
|
||||
b,
|
||||
'two identical arrays, one with an extra property',
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('booleans and arrays', function (t) {
|
||||
t.deepEqualTest(
|
||||
true,
|
||||
[],
|
||||
'true and an empty array',
|
||||
false,
|
||||
false
|
||||
);
|
||||
t.deepEqualTest(
|
||||
false,
|
||||
[],
|
||||
'false and an empty array',
|
||||
false,
|
||||
false
|
||||
);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('arrays initiated', function (t) {
|
||||
var a0 = [
|
||||
undefined,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
1,
|
||||
false,
|
||||
true,
|
||||
undefined,
|
||||
'',
|
||||
'abc',
|
||||
null,
|
||||
undefined
|
||||
];
|
||||
var a1 = [
|
||||
undefined,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
1,
|
||||
false,
|
||||
true,
|
||||
undefined,
|
||||
'',
|
||||
'abc',
|
||||
null,
|
||||
undefined
|
||||
];
|
||||
|
||||
t.deepEqualTest(
|
||||
a0,
|
||||
a1,
|
||||
'arrays with equal contents are equal',
|
||||
true,
|
||||
true,
|
||||
true
|
||||
);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('arrays assigned', function (t) {
|
||||
var a0 = [
|
||||
undefined,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
1,
|
||||
false,
|
||||
true,
|
||||
undefined,
|
||||
'',
|
||||
'abc',
|
||||
null,
|
||||
undefined
|
||||
];
|
||||
var a1 = [];
|
||||
|
||||
a1[0] = undefined;
|
||||
a1[1] = null;
|
||||
a1[2] = -1;
|
||||
a1[3] = 0;
|
||||
a1[4] = 1;
|
||||
a1[5] = false;
|
||||
a1[6] = true;
|
||||
a1[7] = undefined;
|
||||
a1[8] = '';
|
||||
a1[9] = 'abc';
|
||||
a1[10] = null;
|
||||
a1[11] = undefined;
|
||||
a1.length = 12;
|
||||
|
||||
t.deepEqualTest(a0, a1, 'a literal array and an assigned array', true, true);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('arrays push', function (t) {
|
||||
var a0 = [
|
||||
undefined,
|
||||
null,
|
||||
-1,
|
||||
0,
|
||||
1,
|
||||
false,
|
||||
true,
|
||||
undefined,
|
||||
'',
|
||||
'abc',
|
||||
null,
|
||||
undefined
|
||||
],
|
||||
a1 = [];
|
||||
|
||||
a1.push(undefined);
|
||||
a1.push(null);
|
||||
a1.push(-1);
|
||||
a1.push(0);
|
||||
a1.push(1);
|
||||
a1.push(false);
|
||||
a1.push(true);
|
||||
a1.push(undefined);
|
||||
a1.push('');
|
||||
a1.push('abc');
|
||||
a1.push(null);
|
||||
a1.push(undefined);
|
||||
a1.length = 12;
|
||||
|
||||
t.deepEqualTest(a0, a1, 'a literal array and a pushed array', true, true);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('null == undefined', function (t) {
|
||||
t.deepEqualTest(null, undefined, 'null and undefined', true, false);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('NaNs', function (t) {
|
||||
t.deepEqualTest(
|
||||
NaN,
|
||||
NaN,
|
||||
'two NaNs',
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
t.deepEqualTest(
|
||||
{ a: NaN },
|
||||
{ a: NaN },
|
||||
'two equiv objects with a NaN value',
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
t.deepEqualTest(NaN, 1, 'NaN and 1', false, false);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('zeroes', function (t) {
|
||||
t.deepEqualTest(0, -0, '0 and -0', true, false);
|
||||
|
||||
t.deepEqualTest({ a: 0 }, { a: -0 }, 'two objects with a same-keyed 0/-0 value', true, false);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Object.create', { skip: !Object.create }, function (t) {
|
||||
var a = { a: 'A' };
|
||||
var b = Object.create(a);
|
||||
b.b = 'B';
|
||||
var c = Object.create(a);
|
||||
c.b = 'C';
|
||||
|
||||
t.deepEqualTest(
|
||||
b,
|
||||
c,
|
||||
'two objects with the same [[Prototype]] but a different own property',
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Object.create(null)', { skip: !Object.create }, function (t) {
|
||||
t.deepEqualTest(
|
||||
Object.create(null),
|
||||
Object.create(null),
|
||||
'two empty null objects',
|
||||
true,
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
t.deepEqualTest(
|
||||
Object.create(null, { a: { value: 'b' } }),
|
||||
Object.create(null, { a: { value: 'b' } }),
|
||||
'two null objects with the same property pair',
|
||||
true,
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('regexes vs dates', function (t) {
|
||||
var d = new Date(1387585278000);
|
||||
var r = /abc/;
|
||||
|
||||
t.deepEqualTest(d, r, 'Date and RegExp', false, false);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('regexen', function (t) {
|
||||
t.deepEqualTest(/abc/, /xyz/, 'two different regexes', false, false);
|
||||
t.deepEqualTest(/abc/, /abc/, 'two abc regexes', true, true, false);
|
||||
t.deepEqualTest(/xyz/, /xyz/, 'two xyz regexes', true, true, false);
|
||||
|
||||
t.test('fake RegExp', { skip: !hasDunderProto }, function (st) {
|
||||
var a = /abc/g;
|
||||
var b = tag(Object.create(
|
||||
a.__proto__, // eslint-disable-line no-proto
|
||||
gOPDs(a)
|
||||
), 'RegExp');
|
||||
|
||||
st.deepEqualTest(a, b, 'regex and fake regex', false, false);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
var a = /abc/gi;
|
||||
var b = /abc/gi;
|
||||
b.foo = true;
|
||||
t.deepEqualTest(
|
||||
a,
|
||||
b,
|
||||
'two identical regexes, one with an extra property',
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('arrays and objects', function (t) {
|
||||
t.deepEqualTest([], {}, 'empty array and empty object', false, false);
|
||||
t.deepEqualTest([], { length: 0 }, 'empty array and empty arraylike object', false, false);
|
||||
t.deepEqualTest([1], { 0: 1 }, 'array and similar object', false, false);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('functions', function (t) {
|
||||
function f() {}
|
||||
|
||||
t.deepEqualTest(f, f, 'a function and itself', true, true, true);
|
||||
t.deepEqualTest(function () {}, function () {}, 'two distinct functions', false, false, true);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('Errors', function (t) {
|
||||
t.deepEqualTest(new Error('xyz'), new Error('xyz'), 'two errors of the same type with the same message', true, true, false);
|
||||
t.deepEqualTest(new Error('xyz'), new TypeError('xyz'), 'two errors of different types with the same message', false, false);
|
||||
t.deepEqualTest(new Error('xyz'), new Error('zyx'), 'two errors of the same type with a different message', false, false);
|
||||
|
||||
t.deepEqualTest(
|
||||
new Error('a'),
|
||||
assign(new Error('a'), { code: 10 }),
|
||||
'two otherwise equal errors with different own properties',
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
t.test('fake error', { skip: !hasDunderProto }, function (st) {
|
||||
var a = tag({
|
||||
__proto__: null
|
||||
}, 'Error');
|
||||
var b = new RangeError('abc');
|
||||
b.__proto__ = null; // eslint-disable-line no-proto
|
||||
|
||||
st.deepEqualTest(
|
||||
a,
|
||||
b,
|
||||
'null object faking as an Error, RangeError with null proto',
|
||||
false,
|
||||
false
|
||||
);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('errors', function (t) {
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('error = Object', function (t) {
|
||||
t.deepEqualTest(
|
||||
new Error('a'),
|
||||
{ message: 'a' },
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('[[Prototypes]]', function (t) {
|
||||
function C() {}
|
||||
var instance = new C();
|
||||
delete instance.constructor;
|
||||
|
||||
t.deepEqualTest({}, instance, 'two identical objects with different [[Prototypes]]', true, false);
|
||||
|
||||
t.test('Dates with different prototypes', { skip: !hasDunderProto }, function (st) {
|
||||
var d1 = new Date(0);
|
||||
var d2 = new Date(0);
|
||||
|
||||
t.deepEqualTest(d1, d2, 'two dates with the same timestamp', true, true);
|
||||
|
||||
var newProto = {
|
||||
__proto__: Date.prototype
|
||||
};
|
||||
d2.__proto__ = newProto; // eslint-disable-line no-proto
|
||||
st.ok(d2 instanceof Date, 'd2 is still a Date instance after tweaking [[Prototype]]');
|
||||
|
||||
t.deepEqualTest(d1, d2, 'two dates with the same timestamp and different [[Prototype]]', true, false);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('toStringTag', { skip: !hasSymbols || !Symbol.toStringTag }, function (t) {
|
||||
var o1 = {};
|
||||
t.equal(Object.prototype.toString.call(o1), '[object Object]', 'o1: Symbol.toStringTag works');
|
||||
|
||||
var o2 = {};
|
||||
t.equal(Object.prototype.toString.call(o2), '[object Object]', 'o2: original Symbol.toStringTag works');
|
||||
|
||||
t.deepEqualTest(o1, o2, 'two normal empty objects', true, true);
|
||||
|
||||
o2[Symbol.toStringTag] = 'jifasnif';
|
||||
t.equal(Object.prototype.toString.call(o2), '[object jifasnif]', 'o2: modified Symbol.toStringTag works');
|
||||
|
||||
t.deepEqualTest(o1, o2, 'two normal empty objects with different toStringTags', false, false);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('boxed primitives', function (t) {
|
||||
t.deepEqualTest(Object(false), false, 'boxed and primitive `false`', false, false);
|
||||
t.deepEqualTest(Object(true), true, 'boxed and primitive `true`', false, false);
|
||||
t.deepEqualTest(Object(3), 3, 'boxed and primitive `3`', false, false);
|
||||
t.deepEqualTest(Object(NaN), NaN, 'boxed and primitive `NaN`', false, false);
|
||||
t.deepEqualTest(Object(''), '', 'boxed and primitive `""`', false, false);
|
||||
t.deepEqualTest(Object('str'), 'str', 'boxed and primitive `"str"`', false, false);
|
||||
|
||||
t.test('symbol', { skip: !hasSymbols }, function (st) {
|
||||
var s = Symbol('');
|
||||
st.deepEqualTest(Object(s), s, 'boxed and primitive `Symbol()`', false, false);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('bigint', { skip: typeof BigInt !== 'function' }, function (st) {
|
||||
var hhgtg = BigInt(42);
|
||||
st.deepEqualTest(Object(hhgtg), hhgtg, 'boxed and primitive `BigInt(42)`', false, false);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('`valueOf` is called for boxed primitives', function (st) {
|
||||
var a = Object(5);
|
||||
a.valueOf = function () { throw new Error('failed'); };
|
||||
var b = Object(5);
|
||||
b.valueOf = function () { throw new Error('failed'); };
|
||||
|
||||
st.deepEqualTest(a, b, 'two boxed numbers with a thrower valueOf', false, false);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('getters', { skip: !Object.defineProperty }, function (t) {
|
||||
var a = {};
|
||||
Object.defineProperty(a, 'a', { enumerable: true, get: function () { return 5; } });
|
||||
var b = {};
|
||||
Object.defineProperty(b, 'a', { enumerable: true, get: function () { return 6; } });
|
||||
|
||||
t.deepEqualTest(a, b, 'two objects with the same getter but producing different values', false, false);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
var isBrokenNode = isNode && process.env.ASSERT && semver.satisfies(process.version, '<= 13.3.0');
|
||||
test('fake arrays: extra keys will be tested', { skip: !hasDunderProto || isBrokenNode }, function (t) {
|
||||
var a = tag({
|
||||
__proto__: Array.prototype,
|
||||
0: 1,
|
||||
1: 1,
|
||||
2: 'broken',
|
||||
length: 2
|
||||
}, 'Array');
|
||||
if (Object.defineProperty) {
|
||||
Object.defineProperty(a, 'length', {
|
||||
enumerable: false
|
||||
});
|
||||
}
|
||||
|
||||
t.deepEqualTest(a, [1, 1], 'fake and real array with same contents and [[Prototype]]', false, false);
|
||||
|
||||
var b = tag(/abc/, 'Array');
|
||||
b.__proto__ = Array.prototype; // eslint-disable-line no-proto
|
||||
b.length = 3;
|
||||
if (Object.defineProperty) {
|
||||
Object.defineProperty(b, 'length', {
|
||||
enumerable: false
|
||||
});
|
||||
}
|
||||
t.deepEqualTest(b, ['a', 'b', 'c'], 'regex faking as array, and array', false, false);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('circular references', function (t) {
|
||||
var b = {};
|
||||
b.b = b;
|
||||
|
||||
var c = {};
|
||||
c.b = c;
|
||||
|
||||
t.deepEqualTest(
|
||||
b,
|
||||
c,
|
||||
'two self-referencing objects',
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
var d = {};
|
||||
d.a = 1;
|
||||
d.b = d;
|
||||
|
||||
var e = {};
|
||||
e.a = 1;
|
||||
e.b = e.a;
|
||||
|
||||
t.deepEqualTest(
|
||||
d,
|
||||
e,
|
||||
'two deeply self-referencing objects',
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
// io.js v2 is the only version where `console.log(b)` below is catchable
|
||||
var isNodeWhereBufferBreaks = isNode && semver.satisfies(process.version, '< 3');
|
||||
var isNode06 = isNode && semver.satisfies(process.version, '<= 0.6'); // segfaults in node 0.6, it seems
|
||||
|
||||
test('TypedArrays', { skip: !hasTypedArrays }, function (t) {
|
||||
t.test('Buffer faked as Uint8Array', { skip: typeof Buffer !== 'function' || !Object.create || !hasDunderProto || isNode06 }, function (st) {
|
||||
var a = safeBuffer('test');
|
||||
var b = tag(Object.create(
|
||||
a.__proto__, // eslint-disable-line no-proto
|
||||
assign(gOPDs(a), {
|
||||
length: {
|
||||
enumerable: false,
|
||||
value: 4
|
||||
}
|
||||
})
|
||||
), 'Uint8Array');
|
||||
|
||||
st.deepEqualTest(
|
||||
a,
|
||||
b,
|
||||
'Buffer and Uint8Array',
|
||||
isNodeWhereBufferBreaks,
|
||||
isNodeWhereBufferBreaks
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('one TypedArray faking as another', { skip: !hasDunderProto }, function (st) {
|
||||
/* globals Uint8Array, Int8Array */
|
||||
var a = new Uint8Array(10);
|
||||
var b = tag(new Int8Array(10), 'Uint8Array');
|
||||
b.__proto__ = Uint8Array.prototype; // eslint-disable-line no-proto
|
||||
|
||||
st.deepEqualTest(
|
||||
a,
|
||||
b,
|
||||
'Uint8Array, and Int8Array pretending to be a Uint8Array',
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
Reference in New Issue
Block a user