planning
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s

This commit is contained in:
2024-10-14 09:15:30 +02:00
parent bcba00a730
commit 6e64e138e2
21059 changed files with 2317811 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
name: Node CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [8.x, 10.x, 12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test
run: |
yarn install
yarn build
yarn test
env:
CI: true

21
node_modules/@react-dnd/shallowequal/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 Alberto Leal <mailforalberto@gmail.com> (github.com/dashed)
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.

64
node_modules/@react-dnd/shallowequal/README.md generated vendored Normal file
View File

@@ -0,0 +1,64 @@
# shallowequal [![Build Status](https://travis-ci.org/dashed/shallowequal.svg)](https://travis-ci.org/dashed/shallowequal) [![Downloads](https://img.shields.io/npm/dm/shallowequal.svg)](https://npmjs.com/shallowequal) [![npm version](https://img.shields.io/npm/v/shallowequal.svg?style=flat)](https://www.npmjs.com/package/shallowequal)
> `shallowequal` is like lodash's [`isEqual`](https://lodash.com/docs/3.10.1#isEqual) (v3.10.1) but for shallow (strict) equal.
`shallowequal(value, other, [customizer], [thisArg])`
Performs a **_shallow equality_** comparison between two values (i.e. `value` and `other`) to determine if they are equivalent.
The equality check returns true if `value` and `other` are already strictly equal, OR when all the following are true:
- `value` and `other` are both objects with the same keys
- For each key, the value in `value` and `other` are **strictly equal** (`===`)
If `customizer` (expected to be a function) is provided it is invoked to compare values. If `customizer` returns `undefined` (i.e. `void 0`), then comparisons are handled by the `shallowequal` function instead.
The `customizer` is bound to `thisArg` and invoked with three arguments: `(value, other, key)`.
**NOTE:** Docs are (shamelessly) adapted from [lodash's v3.x docs](https://lodash.com/docs/3.10.1#isEqual)
## Install
```sh
$ yarn add shallowequal
# npm v5+
$ npm install shallowequal
# before npm v5
$ npm install --save shallowequal
```
## Usage
```js
const shallowequal = require("shallowequal");
const object = { user: "fred" };
const other = { user: "fred" };
object == other;
// → false
shallowequal(object, other);
// → true
```
## Credit
Code for `shallowEqual` originated from https://github.com/gaearon/react-pure-render/ and has since been refactored to have the exact same API as `lodash.isEqualWith` (as of `v4.17.4`).
## Development
- `node.js` and `npm`. See: https://github.com/creationix/nvm#installation
- `yarn`. See: https://yarnpkg.com/en/docs/install
- `npm` dependencies. Run: `yarn install`
### Chores
- Lint: `yarn lint`
- Test: `yarn test`
- Pretty: `yarn pretty`
- Prepare: `yarn prepare`
## License
MIT.

1
node_modules/@react-dnd/shallowequal/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export declare function shallowEqual<T>(objA: T, objB: T, compare?: (a: T, b: T, key?: string) => boolean | void, compareContext?: any): boolean;

8
node_modules/@react-dnd/shallowequal/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./shallowequal.cjs.production.min.js')
} else {
module.exports = require('./shallowequal.cjs.development.js')
}

View File

@@ -0,0 +1,47 @@
'use strict';
function shallowEqual(objA, objB, compare, compareContext) {
var compareResult = compare ? compare.call(compareContext, objA, objB) : void 0;
if (compareResult !== void 0) {
return !!compareResult;
}
if (objA === objB) {
return true;
}
if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) {
return false;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); // Test for A's keys different from B.
for (var idx = 0; idx < keysA.length; idx++) {
var key = keysA[idx];
if (!bHasOwnProperty(key)) {
return false;
}
var valueA = objA[key];
var valueB = objB[key];
compareResult = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
if (compareResult === false || compareResult === void 0 && valueA !== valueB) {
return false;
}
}
return true;
}
exports.shallowEqual = shallowEqual;
//# sourceMappingURL=shallowequal.cjs.development.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"shallowequal.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["export function shallowEqual<T>(\n objA: T,\n objB: T,\n compare?: (a: T, b: T, key?: string) => boolean | void,\n compareContext?: any\n) {\n var compareResult = compare\n ? compare.call(compareContext, objA, objB)\n : void 0;\n if (compareResult !== void 0) {\n return !!compareResult;\n }\n\n if (objA === objB) {\n return true;\n }\n\n if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) {\n return false;\n }\n\n var keysA = Object.keys(objA);\n var keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);\n\n // Test for A's keys different from B.\n for (var idx = 0; idx < keysA.length; idx++) {\n var key = keysA[idx];\n\n if (!bHasOwnProperty(key)) {\n return false;\n }\n\n var valueA = (objA as any)[key];\n var valueB = (objB as any)[key];\n\n compareResult = compare\n ? compare.call(compareContext, valueA, valueB, key)\n : void 0;\n\n if (\n compareResult === false ||\n (compareResult === void 0 && valueA !== valueB)\n ) {\n return false;\n }\n }\n\n return true;\n}\n"],"names":["shallowEqual","objA","objB","compare","compareContext","compareResult","call","keysA","Object","keys","keysB","length","bHasOwnProperty","prototype","hasOwnProperty","bind","idx","key","valueA","valueB"],"mappings":";;SAAgBA,aACdC,MACAC,MACAC,SACAC;MAEIC,aAAa,GAAGF,OAAO,GACvBA,OAAO,CAACG,IAAR,CAAaF,cAAb,EAA6BH,IAA7B,EAAmCC,IAAnC,CADuB,GAEvB,KAAK,CAFT;;MAGIG,aAAa,KAAK,KAAK,CAA3B,EAA8B;WACrB,CAAC,CAACA,aAAT;;;MAGEJ,IAAI,KAAKC,IAAb,EAAmB;WACV,IAAP;;;MAGE,OAAOD,IAAP,KAAgB,QAAhB,IAA4B,CAACA,IAA7B,IAAqC,OAAOC,IAAP,KAAgB,QAArD,IAAiE,CAACA,IAAtE,EAA4E;WACnE,KAAP;;;MAGEK,KAAK,GAAGC,MAAM,CAACC,IAAP,CAAYR,IAAZ,CAAZ;MACIS,KAAK,GAAGF,MAAM,CAACC,IAAP,CAAYP,IAAZ,CAAZ;;MAEIK,KAAK,CAACI,MAAN,KAAiBD,KAAK,CAACC,MAA3B,EAAmC;WAC1B,KAAP;;;MAGEC,eAAe,GAAGJ,MAAM,CAACK,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCb,IAArC,CAAtB;;OAGK,IAAIc,GAAG,GAAG,CAAf,EAAkBA,GAAG,GAAGT,KAAK,CAACI,MAA9B,EAAsCK,GAAG,EAAzC,EAA6C;QACvCC,GAAG,GAAGV,KAAK,CAACS,GAAD,CAAf;;QAEI,CAACJ,eAAe,CAACK,GAAD,CAApB,EAA2B;aAClB,KAAP;;;QAGEC,MAAM,GAAIjB,IAAY,CAACgB,GAAD,CAA1B;QACIE,MAAM,GAAIjB,IAAY,CAACe,GAAD,CAA1B;IAEAZ,aAAa,GAAGF,OAAO,GACnBA,OAAO,CAACG,IAAR,CAAaF,cAAb,EAA6Bc,MAA7B,EAAqCC,MAArC,EAA6CF,GAA7C,CADmB,GAEnB,KAAK,CAFT;;QAKEZ,aAAa,KAAK,KAAlB,IACCA,aAAa,KAAK,KAAK,CAAvB,IAA4Ba,MAAM,KAAKC,MAF1C,EAGE;aACO,KAAP;;;;SAIG,IAAP;;;;;"}

View File

@@ -0,0 +1,2 @@
"use strict";exports.shallowEqual=function(r,t,e,o){var n=e?e.call(o,r,t):void 0;if(void 0!==n)return!!n;if(r===t)return!0;if("object"!=typeof r||!r||"object"!=typeof t||!t)return!1;var i=Object.keys(r),a=Object.keys(t);if(i.length!==a.length)return!1;for(var f=Object.prototype.hasOwnProperty.bind(t),l=0;l<i.length;l++){var u=i[l];if(!f(u))return!1;var c=r[u],v=t[u];if(!1===(n=e?e.call(o,c,v,u):void 0)||void 0===n&&c!==v)return!1}return!0};
//# sourceMappingURL=shallowequal.cjs.production.min.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"shallowequal.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["export function shallowEqual<T>(\n objA: T,\n objB: T,\n compare?: (a: T, b: T, key?: string) => boolean | void,\n compareContext?: any\n) {\n var compareResult = compare\n ? compare.call(compareContext, objA, objB)\n : void 0;\n if (compareResult !== void 0) {\n return !!compareResult;\n }\n\n if (objA === objB) {\n return true;\n }\n\n if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) {\n return false;\n }\n\n var keysA = Object.keys(objA);\n var keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);\n\n // Test for A's keys different from B.\n for (var idx = 0; idx < keysA.length; idx++) {\n var key = keysA[idx];\n\n if (!bHasOwnProperty(key)) {\n return false;\n }\n\n var valueA = (objA as any)[key];\n var valueB = (objB as any)[key];\n\n compareResult = compare\n ? compare.call(compareContext, valueA, valueB, key)\n : void 0;\n\n if (\n compareResult === false ||\n (compareResult === void 0 && valueA !== valueB)\n ) {\n return false;\n }\n }\n\n return true;\n}\n"],"names":["objA","objB","compare","compareContext","compareResult","call","keysA","Object","keys","keysB","length","bHasOwnProperty","prototype","hasOwnProperty","bind","idx","key","valueA","valueB"],"mappings":"2CACEA,EACAC,EACAC,EACAC,OAEIC,EAAgBF,EAChBA,EAAQG,KAAKF,EAAgBH,EAAMC,QACnC,UACkB,IAAlBG,UACOA,KAGPJ,IAASC,SACJ,KAGW,iBAATD,IAAsBA,GAAwB,iBAATC,IAAsBA,SAC7D,MAGLK,EAAQC,OAAOC,KAAKR,GACpBS,EAAQF,OAAOC,KAAKP,MAEpBK,EAAMI,SAAWD,EAAMC,cAClB,UAGLC,EAAkBJ,OAAOK,UAAUC,eAAeC,KAAKb,GAGlDc,EAAM,EAAGA,EAAMT,EAAMI,OAAQK,IAAO,KACvCC,EAAMV,EAAMS,OAEXJ,EAAgBK,UACZ,MAGLC,EAAUjB,EAAagB,GACvBE,EAAUjB,EAAae,OAOP,KALpBZ,EAAgBF,EACZA,EAAQG,KAAKF,EAAgBc,EAAQC,EAAQF,QAC7C,SAIiB,IAAlBZ,GAA4Ba,IAAWC,SAEjC,SAIJ"}

View File

@@ -0,0 +1,45 @@
function shallowEqual(objA, objB, compare, compareContext) {
var compareResult = compare ? compare.call(compareContext, objA, objB) : void 0;
if (compareResult !== void 0) {
return !!compareResult;
}
if (objA === objB) {
return true;
}
if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) {
return false;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); // Test for A's keys different from B.
for (var idx = 0; idx < keysA.length; idx++) {
var key = keysA[idx];
if (!bHasOwnProperty(key)) {
return false;
}
var valueA = objA[key];
var valueB = objB[key];
compareResult = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
if (compareResult === false || compareResult === void 0 && valueA !== valueB) {
return false;
}
}
return true;
}
export { shallowEqual };
//# sourceMappingURL=shallowequal.esm.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"shallowequal.esm.js","sources":["../src/index.ts"],"sourcesContent":["export function shallowEqual<T>(\n objA: T,\n objB: T,\n compare?: (a: T, b: T, key?: string) => boolean | void,\n compareContext?: any\n) {\n var compareResult = compare\n ? compare.call(compareContext, objA, objB)\n : void 0;\n if (compareResult !== void 0) {\n return !!compareResult;\n }\n\n if (objA === objB) {\n return true;\n }\n\n if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) {\n return false;\n }\n\n var keysA = Object.keys(objA);\n var keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);\n\n // Test for A's keys different from B.\n for (var idx = 0; idx < keysA.length; idx++) {\n var key = keysA[idx];\n\n if (!bHasOwnProperty(key)) {\n return false;\n }\n\n var valueA = (objA as any)[key];\n var valueB = (objB as any)[key];\n\n compareResult = compare\n ? compare.call(compareContext, valueA, valueB, key)\n : void 0;\n\n if (\n compareResult === false ||\n (compareResult === void 0 && valueA !== valueB)\n ) {\n return false;\n }\n }\n\n return true;\n}\n"],"names":["shallowEqual","objA","objB","compare","compareContext","compareResult","call","keysA","Object","keys","keysB","length","bHasOwnProperty","prototype","hasOwnProperty","bind","idx","key","valueA","valueB"],"mappings":"SAAgBA,aACdC,MACAC,MACAC,SACAC;MAEIC,aAAa,GAAGF,OAAO,GACvBA,OAAO,CAACG,IAAR,CAAaF,cAAb,EAA6BH,IAA7B,EAAmCC,IAAnC,CADuB,GAEvB,KAAK,CAFT;;MAGIG,aAAa,KAAK,KAAK,CAA3B,EAA8B;WACrB,CAAC,CAACA,aAAT;;;MAGEJ,IAAI,KAAKC,IAAb,EAAmB;WACV,IAAP;;;MAGE,OAAOD,IAAP,KAAgB,QAAhB,IAA4B,CAACA,IAA7B,IAAqC,OAAOC,IAAP,KAAgB,QAArD,IAAiE,CAACA,IAAtE,EAA4E;WACnE,KAAP;;;MAGEK,KAAK,GAAGC,MAAM,CAACC,IAAP,CAAYR,IAAZ,CAAZ;MACIS,KAAK,GAAGF,MAAM,CAACC,IAAP,CAAYP,IAAZ,CAAZ;;MAEIK,KAAK,CAACI,MAAN,KAAiBD,KAAK,CAACC,MAA3B,EAAmC;WAC1B,KAAP;;;MAGEC,eAAe,GAAGJ,MAAM,CAACK,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCb,IAArC,CAAtB;;OAGK,IAAIc,GAAG,GAAG,CAAf,EAAkBA,GAAG,GAAGT,KAAK,CAACI,MAA9B,EAAsCK,GAAG,EAAzC,EAA6C;QACvCC,GAAG,GAAGV,KAAK,CAACS,GAAD,CAAf;;QAEI,CAACJ,eAAe,CAACK,GAAD,CAApB,EAA2B;aAClB,KAAP;;;QAGEC,MAAM,GAAIjB,IAAY,CAACgB,GAAD,CAA1B;QACIE,MAAM,GAAIjB,IAAY,CAACe,GAAD,CAA1B;IAEAZ,aAAa,GAAGF,OAAO,GACnBA,OAAO,CAACG,IAAR,CAAaF,cAAb,EAA6Bc,MAA7B,EAAqCC,MAArC,EAA6CF,GAA7C,CADmB,GAEnB,KAAK,CAFT;;QAKEZ,aAAa,KAAK,KAAlB,IACCA,aAAa,KAAK,KAAK,CAAvB,IAA4Ba,MAAM,KAAKC,MAF1C,EAGE;aACO,KAAP;;;;SAIG,IAAP;;;;;"}

View File

@@ -0,0 +1 @@
export {};

48
node_modules/@react-dnd/shallowequal/package.json generated vendored Normal file
View File

@@ -0,0 +1,48 @@
{
"name": "@react-dnd/shallowequal",
"version": "2.0.0",
"description": "Like lodash isEqualWith but for shallow equal.",
"main": "dist/index.js",
"module": "dist/shallowequal.esm.js",
"typings": "dist/index.d.ts",
"author": {
"name": "Alberto Leal",
"email": "mailforalberto@gmail.com",
"url": "github.com/dashed"
},
"repository": "react-dnd/shallowequal",
"license": "MIT",
"keywords": [
"shallowequal",
"shallow",
"equal",
"isequal",
"compare",
"isequalwith"
],
"scripts": {
"start": "tsdx watch",
"build": "tsdx build",
"test": "tsdx test",
"lint": "tsdx lint"
},
"peerDependencies": {},
"husky": {
"hooks": {
"pre-commit": "tsdx lint"
}
},
"prettier": {
"printWidth": 80,
"semi": true,
"singleQuote": true,
"trailingComma": "es5"
},
"devDependencies": {
"@types/jest": "^24.0.23",
"husky": "^3.1.0",
"tsdx": "^0.11.0",
"tslib": "^1.10.0",
"typescript": "^3.7.2"
}
}

55
node_modules/@react-dnd/shallowequal/src/index.ts generated vendored Normal file
View File

@@ -0,0 +1,55 @@
export function shallowEqual<T>(
objA: T,
objB: T,
compare?: (a: T, b: T, key?: string) => boolean | void,
compareContext?: any
) {
var compareResult = compare
? compare.call(compareContext, objA, objB)
: void 0;
if (compareResult !== void 0) {
return !!compareResult;
}
if (objA === objB) {
return true;
}
if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) {
return false;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
// Test for A's keys different from B.
for (var idx = 0; idx < keysA.length; idx++) {
var key = keysA[idx];
if (!bHasOwnProperty(key)) {
return false;
}
var valueA = (objA as any)[key];
var valueB = (objB as any)[key];
compareResult = compare
? compare.call(compareContext, valueA, valueB, key)
: void 0;
if (
compareResult === false ||
(compareResult === void 0 && valueA !== valueB)
) {
return false;
}
}
return true;
}

View File

@@ -0,0 +1,140 @@
import { shallowEqual } from '../src/index';
describe('shallowequal', function() {
// eslint-disable-next-line no-sparse-arrays
const falsey = [, '', 0, false, NaN, null, undefined];
// test cases copied from https://github.com/facebook/fbjs/blob/82247de1c33e6f02a199778203643eaee16ea4dc/src/core/__tests__/shallowEqual-test.js
it('returns false if either argument is null', () => {
expect(shallowEqual(null, {})).toEqual(false);
expect(shallowEqual({}, null)).toEqual(false);
});
it('returns true if both arguments are null or undefined', () => {
expect(shallowEqual(null, null)).toEqual(true);
expect(shallowEqual(undefined, undefined)).toEqual(true);
});
it('returns true if arguments are shallow equal', () => {
expect(shallowEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2, c: 3 })).toEqual(
true
);
});
it('returns false if arguments are not objects and not equal', () => {
expect(shallowEqual(1, 2)).toEqual(false);
});
it('returns false if only one argument is not an object', () => {
expect(shallowEqual<any>(1, {})).toEqual(false);
});
it('returns false if first argument has too many keys', () => {
expect(shallowEqual({ a: 1, b: 2, c: 3 }, { a: 1, b: 2 })).toEqual(false);
});
it('returns false if second argument has too many keys', () => {
expect(shallowEqual({ a: 1, b: 2 }, { a: 1, b: 2, c: 3 })).toEqual(false);
});
it('returns true if values are not primitives but are ===', () => {
let obj = {};
expect(
shallowEqual({ a: 1, b: 2, c: obj }, { a: 1, b: 2, c: obj })
).toEqual(true);
});
// subsequent test cases are copied from lodash tests
it('returns false if arguments are not shallow equal', () => {
expect(shallowEqual({ a: 1, b: 2, c: {} }, { a: 1, b: 2, c: {} })).toEqual(
false
);
});
it('should provide the correct `customizer` arguments', () => {
let argsList: any[] = [];
const arry = [1, 2];
const object1: any = { a: arry, b: null };
const object2: any = { a: arry, b: null };
object1.b = object2;
object2.b = object1;
const expected = [
[object1, object2],
[object1.a, object2.a, 'a'],
[object1.b, object2.b, 'b'],
];
shallowEqual(object1, object2, function(...args) {
argsList.push(args);
});
expect(argsList).toEqual(expected);
});
it('should set the `this` binding', () => {
const actual = shallowEqual(
'a',
'b',
function compare(this: any, a, b) {
return this[a] === this[b];
},
{ a: 1, b: 1 }
);
expect(actual).toEqual(true);
});
it('should handle comparisons if `customizer` returns `undefined`', () => {
const noop = () => void 0;
expect(shallowEqual('a', 'a', noop)).toEqual(true);
expect(shallowEqual(['a'], ['a'], noop)).toEqual(true);
expect(shallowEqual({ '0': 'a' }, { '0': 'a' }, noop)).toEqual(true);
});
it('should not handle comparisons if `customizer` returns `true`', () => {
const customizer = (value: any) => typeof value === 'string' || undefined;
expect(shallowEqual('a', 'b', customizer)).toEqual(true);
expect(shallowEqual(['a'], ['b'], customizer)).toEqual(true);
expect(shallowEqual({ '0': 'a' }, { '0': 'b' }, customizer)).toEqual(true);
});
it('should not handle comparisons if `customizer` returns `false`', () => {
const customizer = (value: any) =>
typeof value === 'string' ? false : undefined;
expect(shallowEqual('a', 'a', customizer)).toEqual(false);
expect(shallowEqual(['a'], ['a'], customizer)).toEqual(false);
expect(shallowEqual({ '0': 'a' }, { '0': 'a' }, customizer)).toEqual(false);
});
it('should return a boolean value even if `customizer` does not', () => {
let actual = shallowEqual('a', 'b', () => 'c' as any);
expect(actual).toEqual(true);
const values = falsey.filter(v => v !== undefined);
const expected = values.map(() => false);
const result: boolean[] = [];
values.forEach(value => {
result.push(shallowEqual('a', 'a', () => value as any));
});
expect(result).toEqual(expected);
});
it('should treat objects created by `Object.create(null)` like any other plain object', () => {
class Foo {
public a = 1;
}
const object2 = { a: 1 };
expect(shallowEqual(new Foo(), object2)).toEqual(true);
const object1 = Object.create(null);
object1.a = 1;
expect(shallowEqual(object1, object2)).toEqual(true);
});
});

30
node_modules/@react-dnd/shallowequal/tsconfig.json generated vendored Normal file
View File

@@ -0,0 +1,30 @@
{
"include": ["src", "types", "test"],
"compilerOptions": {
"target": "es5",
"module": "esnext",
"lib": ["dom", "esnext"],
"importHelpers": true,
"declaration": true,
"sourceMap": true,
"rootDir": "./",
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node",
"baseUrl": "./",
"paths": {
"*": ["src/*", "node_modules/*"]
},
"jsx": "react",
"esModuleInterop": true
}
}