@wordpress/is-shallow-equal 5.37.0 → 5.37.1-next.79a2f3cdd.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -2
- package/LICENSE.md +1 -1
- package/build/{arrays.js → arrays.cjs} +1 -1
- package/build/{index.js → index.cjs} +7 -7
- package/build/index.cjs.map +7 -0
- package/build/{objects.js → objects.cjs} +1 -1
- package/build-module/{arrays.js → arrays.mjs} +1 -1
- package/build-module/{index.js → index.mjs} +6 -7
- package/build-module/index.mjs.map +7 -0
- package/build-module/{objects.js → objects.mjs} +1 -1
- package/build-types/index.d.ts +6 -2
- package/build-types/index.d.ts.map +1 -1
- package/package.json +10 -7
- package/src/index.ts +4 -3
- package/build/index.js.map +0 -7
- package/build-module/index.js.map +0 -7
- /package/build/{arrays.js.map → arrays.cjs.map} +0 -0
- /package/build/{objects.js.map → objects.cjs.map} +0 -0
- /package/build-module/{arrays.js.map → arrays.mjs.map} +0 -0
- /package/build-module/{objects.js.map → objects.mjs.map} +0 -0
package/CHANGELOG.md
CHANGED
package/LICENSE.md
CHANGED
|
@@ -31,14 +31,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
default: () => isShallowEqual,
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
isShallowEqual: () => isShallowEqual,
|
|
35
|
+
isShallowEqualArrays: () => import_arrays.default,
|
|
36
|
+
isShallowEqualObjects: () => import_objects.default
|
|
36
37
|
});
|
|
37
38
|
module.exports = __toCommonJS(index_exports);
|
|
38
|
-
var import_objects = __toESM(require("./objects"));
|
|
39
|
-
var import_arrays = __toESM(require("./arrays"));
|
|
40
|
-
var import_objects2 = __toESM(require("./objects"));
|
|
41
|
-
var import_arrays2 = __toESM(require("./arrays"));
|
|
39
|
+
var import_objects = __toESM(require("./objects.cjs"));
|
|
40
|
+
var import_arrays = __toESM(require("./arrays.cjs"));
|
|
42
41
|
function isShallowEqual(a, b) {
|
|
43
42
|
if (a && b) {
|
|
44
43
|
if (a.constructor === Object && b.constructor === Object) {
|
|
@@ -51,7 +50,8 @@ function isShallowEqual(a, b) {
|
|
|
51
50
|
}
|
|
52
51
|
// Annotate the CommonJS export names for ESM import in node:
|
|
53
52
|
0 && (module.exports = {
|
|
53
|
+
isShallowEqual,
|
|
54
54
|
isShallowEqualArrays,
|
|
55
55
|
isShallowEqualObjects
|
|
56
56
|
});
|
|
57
|
-
//# sourceMappingURL=index.
|
|
57
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport isShallowEqualObjects from './objects';\nimport isShallowEqualArrays from './arrays';\n\nexport type ComparableObject = Record< string, any >;\n\n/**\n * Returns true if the two arrays or objects are shallow equal, or false\n * otherwise. Also handles primitive values, just in case.\n *\n * @param a First object or array to compare.\n * @param b Second object or array to compare.\n *\n * @return Whether the two values are shallow equal.\n */\nexport default function isShallowEqual( a: unknown, b: unknown ): boolean {\n\tif ( a && b ) {\n\t\tif ( a.constructor === Object && b.constructor === Object ) {\n\t\t\treturn isShallowEqualObjects( a, b );\n\t\t} else if ( Array.isArray( a ) && Array.isArray( b ) ) {\n\t\t\treturn isShallowEqualArrays( a, b );\n\t\t}\n\t}\n\n\treturn a === b;\n}\n\n// `isShallowEqual` is exported also as a named export because esbuild cannot\n// expose the default export from the `window.wp.isShallowEqual` global.\nexport { isShallowEqual, isShallowEqualObjects, isShallowEqualArrays };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,4CAAAA;AAAA,EAAA,4CAAAC;AAAA;AAAA;AAGA,qBAAkC;AAClC,oBAAiC;AAalB,SAAR,eAAiC,GAAY,GAAsB;AACzE,MAAK,KAAK,GAAI;AACb,QAAK,EAAE,gBAAgB,UAAU,EAAE,gBAAgB,QAAS;AAC3D,iBAAO,eAAAA,SAAuB,GAAG,CAAE;AAAA,IACpC,WAAY,MAAM,QAAS,CAAE,KAAK,MAAM,QAAS,CAAE,GAAI;AACtD,iBAAO,cAAAD,SAAsB,GAAG,CAAE;AAAA,IACnC;AAAA,EACD;AAEA,SAAO,MAAM;AACd;",
|
|
6
|
+
"names": ["isShallowEqualArrays", "isShallowEqualObjects"]
|
|
7
|
+
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
// packages/is-shallow-equal/src/index.ts
|
|
2
|
-
import isShallowEqualObjects from "./objects";
|
|
3
|
-
import isShallowEqualArrays from "./arrays";
|
|
4
|
-
import { default as default2 } from "./objects";
|
|
5
|
-
import { default as default3 } from "./arrays";
|
|
2
|
+
import isShallowEqualObjects from "./objects.mjs";
|
|
3
|
+
import isShallowEqualArrays from "./arrays.mjs";
|
|
6
4
|
function isShallowEqual(a, b) {
|
|
7
5
|
if (a && b) {
|
|
8
6
|
if (a.constructor === Object && b.constructor === Object) {
|
|
@@ -15,7 +13,8 @@ function isShallowEqual(a, b) {
|
|
|
15
13
|
}
|
|
16
14
|
export {
|
|
17
15
|
isShallowEqual as default,
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
isShallowEqual,
|
|
17
|
+
isShallowEqualArrays,
|
|
18
|
+
isShallowEqualObjects
|
|
20
19
|
};
|
|
21
|
-
//# sourceMappingURL=index.
|
|
20
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport isShallowEqualObjects from './objects';\nimport isShallowEqualArrays from './arrays';\n\nexport type ComparableObject = Record< string, any >;\n\n/**\n * Returns true if the two arrays or objects are shallow equal, or false\n * otherwise. Also handles primitive values, just in case.\n *\n * @param a First object or array to compare.\n * @param b Second object or array to compare.\n *\n * @return Whether the two values are shallow equal.\n */\nexport default function isShallowEqual( a: unknown, b: unknown ): boolean {\n\tif ( a && b ) {\n\t\tif ( a.constructor === Object && b.constructor === Object ) {\n\t\t\treturn isShallowEqualObjects( a, b );\n\t\t} else if ( Array.isArray( a ) && Array.isArray( b ) ) {\n\t\t\treturn isShallowEqualArrays( a, b );\n\t\t}\n\t}\n\n\treturn a === b;\n}\n\n// `isShallowEqual` is exported also as a named export because esbuild cannot\n// expose the default export from the `window.wp.isShallowEqual` global.\nexport { isShallowEqual, isShallowEqualObjects, isShallowEqualArrays };\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,2BAA2B;AAClC,OAAO,0BAA0B;AAalB,SAAR,eAAiC,GAAY,GAAsB;AACzE,MAAK,KAAK,GAAI;AACb,QAAK,EAAE,gBAAgB,UAAU,EAAE,gBAAgB,QAAS;AAC3D,aAAO,sBAAuB,GAAG,CAAE;AAAA,IACpC,WAAY,MAAM,QAAS,CAAE,KAAK,MAAM,QAAS,CAAE,GAAI;AACtD,aAAO,qBAAsB,GAAG,CAAE;AAAA,IACnC;AAAA,EACD;AAEA,SAAO,MAAM;AACd;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build-types/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import isShallowEqualObjects from './objects';
|
|
5
|
+
import isShallowEqualArrays from './arrays';
|
|
3
6
|
export type ComparableObject = Record<string, any>;
|
|
4
7
|
/**
|
|
5
8
|
* Returns true if the two arrays or objects are shallow equal, or false
|
|
@@ -11,4 +14,5 @@ export type ComparableObject = Record<string, any>;
|
|
|
11
14
|
* @return Whether the two values are shallow equal.
|
|
12
15
|
*/
|
|
13
16
|
export default function isShallowEqual(a: unknown, b: unknown): boolean;
|
|
17
|
+
export { isShallowEqual, isShallowEqualObjects, isShallowEqualArrays };
|
|
14
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,qBAAqB,MAAM,WAAW,CAAC;AAC9C,OAAO,oBAAoB,MAAM,UAAU,CAAC;AAE5C,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAE,MAAM,EAAE,GAAG,CAAE,CAAC;AAErD;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAI,OAAO,CAUxE;AAID,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/is-shallow-equal",
|
|
3
|
-
"version": "5.37.0",
|
|
3
|
+
"version": "5.37.1-next.79a2f3cdd.0",
|
|
4
4
|
"description": "Test for shallow equality between two objects or arrays.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -25,19 +25,19 @@
|
|
|
25
25
|
"npm": ">=8.19.2"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
|
+
"src",
|
|
28
29
|
"build",
|
|
29
30
|
"build-module",
|
|
30
31
|
"build-types",
|
|
31
|
-
"src",
|
|
32
32
|
"*.md"
|
|
33
33
|
],
|
|
34
|
-
"main": "build/index.
|
|
35
|
-
"module": "build-module/index.
|
|
34
|
+
"main": "build/index.cjs",
|
|
35
|
+
"module": "build-module/index.mjs",
|
|
36
36
|
"exports": {
|
|
37
37
|
".": {
|
|
38
38
|
"types": "./build-types/index.d.ts",
|
|
39
|
-
"import": "./build-module/index.
|
|
40
|
-
"require": "./build/index.
|
|
39
|
+
"import": "./build-module/index.mjs",
|
|
40
|
+
"require": "./build/index.cjs"
|
|
41
41
|
},
|
|
42
42
|
"./package.json": "./package.json"
|
|
43
43
|
},
|
|
@@ -45,8 +45,11 @@
|
|
|
45
45
|
"wpScript": true,
|
|
46
46
|
"types": "build-types",
|
|
47
47
|
"sideEffects": false,
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"benchmark": "2.1.4"
|
|
50
|
+
},
|
|
48
51
|
"publishConfig": {
|
|
49
52
|
"access": "public"
|
|
50
53
|
},
|
|
51
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "6a324496a37d9a333a11d4d7fe5fb93b8152a5ba"
|
|
52
55
|
}
|
package/src/index.ts
CHANGED
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
import isShallowEqualObjects from './objects';
|
|
5
5
|
import isShallowEqualArrays from './arrays';
|
|
6
6
|
|
|
7
|
-
export { default as isShallowEqualObjects } from './objects';
|
|
8
|
-
export { default as isShallowEqualArrays } from './arrays';
|
|
9
|
-
|
|
10
7
|
export type ComparableObject = Record< string, any >;
|
|
11
8
|
|
|
12
9
|
/**
|
|
@@ -29,3 +26,7 @@ export default function isShallowEqual( a: unknown, b: unknown ): boolean {
|
|
|
29
26
|
|
|
30
27
|
return a === b;
|
|
31
28
|
}
|
|
29
|
+
|
|
30
|
+
// `isShallowEqual` is exported also as a named export because esbuild cannot
|
|
31
|
+
// expose the default export from the `window.wp.isShallowEqual` global.
|
|
32
|
+
export { isShallowEqual, isShallowEqualObjects, isShallowEqualArrays };
|
package/build/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport isShallowEqualObjects from './objects';\nimport isShallowEqualArrays from './arrays';\n\nexport { default as isShallowEqualObjects } from './objects';\nexport { default as isShallowEqualArrays } from './arrays';\n\nexport type ComparableObject = Record< string, any >;\n\n/**\n * Returns true if the two arrays or objects are shallow equal, or false\n * otherwise. Also handles primitive values, just in case.\n *\n * @param a First object or array to compare.\n * @param b Second object or array to compare.\n *\n * @return Whether the two values are shallow equal.\n */\nexport default function isShallowEqual( a: unknown, b: unknown ): boolean {\n\tif ( a && b ) {\n\t\tif ( a.constructor === Object && b.constructor === Object ) {\n\t\t\treturn isShallowEqualObjects( a, b );\n\t\t} else if ( Array.isArray( a ) && Array.isArray( b ) ) {\n\t\t\treturn isShallowEqualArrays( a, b );\n\t\t}\n\t}\n\n\treturn a === b;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAkC;AAClC,oBAAiC;AAEjC,IAAAA,kBAAiD;AACjD,IAAAC,iBAAgD;AAajC,SAAR,eAAiC,GAAY,GAAsB;AACzE,MAAK,KAAK,GAAI;AACb,QAAK,EAAE,gBAAgB,UAAU,EAAE,gBAAgB,QAAS;AAC3D,iBAAO,eAAAC,SAAuB,GAAG,CAAE;AAAA,IACpC,WAAY,MAAM,QAAS,CAAE,KAAK,MAAM,QAAS,CAAE,GAAI;AACtD,iBAAO,cAAAC,SAAsB,GAAG,CAAE;AAAA,IACnC;AAAA,EACD;AAEA,SAAO,MAAM;AACd;",
|
|
6
|
-
"names": ["import_objects", "import_arrays", "isShallowEqualObjects", "isShallowEqualArrays"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport isShallowEqualObjects from './objects';\nimport isShallowEqualArrays from './arrays';\n\nexport { default as isShallowEqualObjects } from './objects';\nexport { default as isShallowEqualArrays } from './arrays';\n\nexport type ComparableObject = Record< string, any >;\n\n/**\n * Returns true if the two arrays or objects are shallow equal, or false\n * otherwise. Also handles primitive values, just in case.\n *\n * @param a First object or array to compare.\n * @param b Second object or array to compare.\n *\n * @return Whether the two values are shallow equal.\n */\nexport default function isShallowEqual( a: unknown, b: unknown ): boolean {\n\tif ( a && b ) {\n\t\tif ( a.constructor === Object && b.constructor === Object ) {\n\t\t\treturn isShallowEqualObjects( a, b );\n\t\t} else if ( Array.isArray( a ) && Array.isArray( b ) ) {\n\t\t\treturn isShallowEqualArrays( a, b );\n\t\t}\n\t}\n\n\treturn a === b;\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,2BAA2B;AAClC,OAAO,0BAA0B;AAEjC,SAAoB,WAAXA,gBAAwC;AACjD,SAAoB,WAAXA,gBAAuC;AAajC,SAAR,eAAiC,GAAY,GAAsB;AACzE,MAAK,KAAK,GAAI;AACb,QAAK,EAAE,gBAAgB,UAAU,EAAE,gBAAgB,QAAS;AAC3D,aAAO,sBAAuB,GAAG,CAAE;AAAA,IACpC,WAAY,MAAM,QAAS,CAAE,KAAK,MAAM,QAAS,CAAE,GAAI;AACtD,aAAO,qBAAsB,GAAG,CAAE;AAAA,IACnC;AAAA,EACD;AAEA,SAAO,MAAM;AACd;",
|
|
6
|
-
"names": ["default"]
|
|
7
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|