@wordpress/is-shallow-equal 5.31.1-next.f56bd8138.0 → 5.32.1-next.47f435fc9.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 +2 -0
- package/build/arrays.js +22 -13
- package/build/arrays.js.map +7 -1
- package/build/index.js +44 -34
- package/build/index.js.map +7 -1
- package/build/objects.js +29 -23
- package/build/objects.js.map +7 -1
- package/build-module/arrays.js +5 -10
- package/build-module/arrays.js.map +7 -1
- package/build-module/index.js +11 -18
- package/build-module/index.js.map +7 -1
- package/build-module/objects.js +12 -20
- package/build-module/objects.js.map +7 -1
- package/package.json +10 -5
package/CHANGELOG.md
CHANGED
package/build/arrays.js
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var arrays_exports = {};
|
|
20
|
+
__export(arrays_exports, {
|
|
21
|
+
default: () => isShallowEqualArrays
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
/**
|
|
8
|
-
* Returns true if the two arrays are shallow equal, or false otherwise.
|
|
9
|
-
*
|
|
10
|
-
* @param a First array to compare.
|
|
11
|
-
* @param b Second array to compare.
|
|
12
|
-
*
|
|
13
|
-
* @return Whether the two arrays are shallow equal.
|
|
14
|
-
*/
|
|
23
|
+
module.exports = __toCommonJS(arrays_exports);
|
|
15
24
|
function isShallowEqualArrays(a, b) {
|
|
16
25
|
if (a === b) {
|
|
17
26
|
return true;
|
|
@@ -26,4 +35,4 @@ function isShallowEqualArrays(a, b) {
|
|
|
26
35
|
}
|
|
27
36
|
return true;
|
|
28
37
|
}
|
|
29
|
-
//# sourceMappingURL=arrays.js.map
|
|
38
|
+
//# sourceMappingURL=arrays.js.map
|
package/build/arrays.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/arrays.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Returns true if the two arrays are shallow equal, or false otherwise.\n *\n * @param a First array to compare.\n * @param b Second array to compare.\n *\n * @return Whether the two arrays are shallow equal.\n */\nexport default function isShallowEqualArrays(\n\ta: unknown[],\n\tb: unknown[]\n): boolean {\n\tif ( a === b ) {\n\t\treturn true;\n\t}\n\n\tif ( a.length !== b.length ) {\n\t\treturn false;\n\t}\n\n\tfor ( let i = 0, len = a.length; i < len; i++ ) {\n\t\tif ( a[ i ] !== b[ i ] ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQe,SAAR,qBACN,GACA,GACU;AACV,MAAK,MAAM,GAAI;AACd,WAAO;AAAA,EACR;AAEA,MAAK,EAAE,WAAW,EAAE,QAAS;AAC5B,WAAO;AAAA,EACR;AAEA,WAAU,IAAI,GAAG,MAAM,EAAE,QAAQ,IAAI,KAAK,KAAM;AAC/C,QAAK,EAAG,CAAE,MAAM,EAAG,CAAE,GAAI;AACxB,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/index.js
CHANGED
|
@@ -1,45 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return _objects.default;
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
17
|
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var index_exports = {};
|
|
30
|
+
__export(index_exports, {
|
|
31
|
+
default: () => isShallowEqual,
|
|
32
|
+
isShallowEqualArrays: () => import_arrays2.default,
|
|
33
|
+
isShallowEqualObjects: () => import_objects2.default
|
|
19
34
|
});
|
|
20
|
-
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Returns true if the two arrays or objects are shallow equal, or false
|
|
28
|
-
* otherwise. Also handles primitive values, just in case.
|
|
29
|
-
*
|
|
30
|
-
* @param a First object or array to compare.
|
|
31
|
-
* @param b Second object or array to compare.
|
|
32
|
-
*
|
|
33
|
-
* @return Whether the two values are shallow equal.
|
|
34
|
-
*/
|
|
35
|
+
module.exports = __toCommonJS(index_exports);
|
|
36
|
+
var import_objects = __toESM(require("./objects"));
|
|
37
|
+
var import_arrays = __toESM(require("./arrays"));
|
|
38
|
+
var import_objects2 = __toESM(require("./objects"));
|
|
39
|
+
var import_arrays2 = __toESM(require("./arrays"));
|
|
35
40
|
function isShallowEqual(a, b) {
|
|
36
41
|
if (a && b) {
|
|
37
42
|
if (a.constructor === Object && b.constructor === Object) {
|
|
38
|
-
return (0,
|
|
43
|
+
return (0, import_objects.default)(a, b);
|
|
39
44
|
} else if (Array.isArray(a) && Array.isArray(b)) {
|
|
40
|
-
return (0,
|
|
45
|
+
return (0, import_arrays.default)(a, b);
|
|
41
46
|
}
|
|
42
47
|
}
|
|
43
48
|
return a === b;
|
|
44
49
|
}
|
|
45
|
-
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
isShallowEqualArrays,
|
|
53
|
+
isShallowEqualObjects
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
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
|
+
}
|
package/build/objects.js
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var objects_exports = {};
|
|
20
|
+
__export(objects_exports, {
|
|
21
|
+
default: () => isShallowEqualObjects
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Returns true if the two objects are shallow equal, or false otherwise.
|
|
13
|
-
*
|
|
14
|
-
* @param a First object to compare.
|
|
15
|
-
* @param b Second object to compare.
|
|
16
|
-
*
|
|
17
|
-
* @return Whether the two objects are shallow equal.
|
|
18
|
-
*/
|
|
23
|
+
module.exports = __toCommonJS(objects_exports);
|
|
19
24
|
function isShallowEqualObjects(a, b) {
|
|
20
25
|
if (a === b) {
|
|
21
26
|
return true;
|
|
@@ -30,16 +35,17 @@ function isShallowEqualObjects(a, b) {
|
|
|
30
35
|
const key = aKeys[i];
|
|
31
36
|
const aValue = a[key];
|
|
32
37
|
if (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
// In iterating only the keys of the first object after verifying
|
|
39
|
+
// equal lengths, account for the case that an explicit `undefined`
|
|
40
|
+
// value in the first is implicitly undefined in the second.
|
|
41
|
+
//
|
|
42
|
+
// Example: isShallowEqualObjects( { a: undefined }, { b: 5 } )
|
|
43
|
+
aValue === void 0 && !b.hasOwnProperty(key) || aValue !== b[key]
|
|
44
|
+
) {
|
|
39
45
|
return false;
|
|
40
46
|
}
|
|
41
47
|
i++;
|
|
42
48
|
}
|
|
43
49
|
return true;
|
|
44
50
|
}
|
|
45
|
-
//# sourceMappingURL=objects.js.map
|
|
51
|
+
//# sourceMappingURL=objects.js.map
|
package/build/objects.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/objects.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { ComparableObject } from '.';\n\n/**\n * Returns true if the two objects are shallow equal, or false otherwise.\n *\n * @param a First object to compare.\n * @param b Second object to compare.\n *\n * @return Whether the two objects are shallow equal.\n */\nexport default function isShallowEqualObjects(\n\ta: ComparableObject,\n\tb: ComparableObject\n): boolean {\n\tif ( a === b ) {\n\t\treturn true;\n\t}\n\n\tconst aKeys = Object.keys( a );\n\tconst bKeys = Object.keys( b );\n\n\tif ( aKeys.length !== bKeys.length ) {\n\t\treturn false;\n\t}\n\n\tlet i = 0;\n\n\twhile ( i < aKeys.length ) {\n\t\tconst key = aKeys[ i ];\n\t\tconst aValue = a[ key ];\n\n\t\tif (\n\t\t\t// In iterating only the keys of the first object after verifying\n\t\t\t// equal lengths, account for the case that an explicit `undefined`\n\t\t\t// value in the first is implicitly undefined in the second.\n\t\t\t//\n\t\t\t// Example: isShallowEqualObjects( { a: undefined }, { b: 5 } )\n\t\t\t( aValue === undefined && ! b.hasOwnProperty( key ) ) ||\n\t\t\taValue !== b[ key ]\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\ti++;\n\t}\n\n\treturn true;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAae,SAAR,sBACN,GACA,GACU;AACV,MAAK,MAAM,GAAI;AACd,WAAO;AAAA,EACR;AAEA,QAAM,QAAQ,OAAO,KAAM,CAAE;AAC7B,QAAM,QAAQ,OAAO,KAAM,CAAE;AAE7B,MAAK,MAAM,WAAW,MAAM,QAAS;AACpC,WAAO;AAAA,EACR;AAEA,MAAI,IAAI;AAER,SAAQ,IAAI,MAAM,QAAS;AAC1B,UAAM,MAAM,MAAO,CAAE;AACrB,UAAM,SAAS,EAAG,GAAI;AAEtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMG,WAAW,UAAa,CAAE,EAAE,eAAgB,GAAI,KAClD,WAAW,EAAG,GAAI;AAAA,MACjB;AACD,aAAO;AAAA,IACR;AAEA;AAAA,EACD;AAEA,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build-module/arrays.js
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Returns true if the two arrays are shallow equal, or false otherwise.
|
|
3
|
-
*
|
|
4
|
-
* @param a First array to compare.
|
|
5
|
-
* @param b Second array to compare.
|
|
6
|
-
*
|
|
7
|
-
* @return Whether the two arrays are shallow equal.
|
|
8
|
-
*/
|
|
9
|
-
export default function isShallowEqualArrays(a, b) {
|
|
1
|
+
function isShallowEqualArrays(a, b) {
|
|
10
2
|
if (a === b) {
|
|
11
3
|
return true;
|
|
12
4
|
}
|
|
@@ -20,4 +12,7 @@ export default function isShallowEqualArrays(a, b) {
|
|
|
20
12
|
}
|
|
21
13
|
return true;
|
|
22
14
|
}
|
|
23
|
-
|
|
15
|
+
export {
|
|
16
|
+
isShallowEqualArrays as default
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=arrays.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/arrays.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Returns true if the two arrays are shallow equal, or false otherwise.\n *\n * @param a First array to compare.\n * @param b Second array to compare.\n *\n * @return Whether the two arrays are shallow equal.\n */\nexport default function isShallowEqualArrays(\n\ta: unknown[],\n\tb: unknown[]\n): boolean {\n\tif ( a === b ) {\n\t\treturn true;\n\t}\n\n\tif ( a.length !== b.length ) {\n\t\treturn false;\n\t}\n\n\tfor ( let i = 0, len = a.length; i < len; i++ ) {\n\t\tif ( a[ i ] !== b[ i ] ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n"],
|
|
5
|
+
"mappings": "AAQe,SAAR,qBACN,GACA,GACU;AACV,MAAK,MAAM,GAAI;AACd,WAAO;AAAA,EACR;AAEA,MAAK,EAAE,WAAW,EAAE,QAAS;AAC5B,WAAO;AAAA,EACR;AAEA,WAAU,IAAI,GAAG,MAAM,EAAE,QAAQ,IAAI,KAAK,KAAM;AAC/C,QAAK,EAAG,CAAE,MAAM,EAAG,CAAE,GAAI;AACxB,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build-module/index.js
CHANGED
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
export { default as isShallowEqualObjects } from './objects';
|
|
7
|
-
export { default as isShallowEqualArrays } from './arrays';
|
|
8
|
-
/**
|
|
9
|
-
* Returns true if the two arrays or objects are shallow equal, or false
|
|
10
|
-
* otherwise. Also handles primitive values, just in case.
|
|
11
|
-
*
|
|
12
|
-
* @param a First object or array to compare.
|
|
13
|
-
* @param b Second object or array to compare.
|
|
14
|
-
*
|
|
15
|
-
* @return Whether the two values are shallow equal.
|
|
16
|
-
*/
|
|
17
|
-
export default function isShallowEqual(a, b) {
|
|
1
|
+
import isShallowEqualObjects from "./objects";
|
|
2
|
+
import isShallowEqualArrays from "./arrays";
|
|
3
|
+
import { default as default2 } from "./objects";
|
|
4
|
+
import { default as default3 } from "./arrays";
|
|
5
|
+
function isShallowEqual(a, b) {
|
|
18
6
|
if (a && b) {
|
|
19
7
|
if (a.constructor === Object && b.constructor === Object) {
|
|
20
8
|
return isShallowEqualObjects(a, b);
|
|
@@ -24,4 +12,9 @@ export default function isShallowEqual(a, b) {
|
|
|
24
12
|
}
|
|
25
13
|
return a === b;
|
|
26
14
|
}
|
|
27
|
-
|
|
15
|
+
export {
|
|
16
|
+
isShallowEqual as default,
|
|
17
|
+
default3 as isShallowEqualArrays,
|
|
18
|
+
default2 as isShallowEqualObjects
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
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
|
+
}
|
package/build-module/objects.js
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Returns true if the two objects are shallow equal, or false otherwise.
|
|
7
|
-
*
|
|
8
|
-
* @param a First object to compare.
|
|
9
|
-
* @param b Second object to compare.
|
|
10
|
-
*
|
|
11
|
-
* @return Whether the two objects are shallow equal.
|
|
12
|
-
*/
|
|
13
|
-
export default function isShallowEqualObjects(a, b) {
|
|
1
|
+
function isShallowEqualObjects(a, b) {
|
|
14
2
|
if (a === b) {
|
|
15
3
|
return true;
|
|
16
4
|
}
|
|
@@ -24,16 +12,20 @@ export default function isShallowEqualObjects(a, b) {
|
|
|
24
12
|
const key = aKeys[i];
|
|
25
13
|
const aValue = a[key];
|
|
26
14
|
if (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
15
|
+
// In iterating only the keys of the first object after verifying
|
|
16
|
+
// equal lengths, account for the case that an explicit `undefined`
|
|
17
|
+
// value in the first is implicitly undefined in the second.
|
|
18
|
+
//
|
|
19
|
+
// Example: isShallowEqualObjects( { a: undefined }, { b: 5 } )
|
|
20
|
+
aValue === void 0 && !b.hasOwnProperty(key) || aValue !== b[key]
|
|
21
|
+
) {
|
|
33
22
|
return false;
|
|
34
23
|
}
|
|
35
24
|
i++;
|
|
36
25
|
}
|
|
37
26
|
return true;
|
|
38
27
|
}
|
|
39
|
-
|
|
28
|
+
export {
|
|
29
|
+
isShallowEqualObjects as default
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=objects.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/objects.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { ComparableObject } from '.';\n\n/**\n * Returns true if the two objects are shallow equal, or false otherwise.\n *\n * @param a First object to compare.\n * @param b Second object to compare.\n *\n * @return Whether the two objects are shallow equal.\n */\nexport default function isShallowEqualObjects(\n\ta: ComparableObject,\n\tb: ComparableObject\n): boolean {\n\tif ( a === b ) {\n\t\treturn true;\n\t}\n\n\tconst aKeys = Object.keys( a );\n\tconst bKeys = Object.keys( b );\n\n\tif ( aKeys.length !== bKeys.length ) {\n\t\treturn false;\n\t}\n\n\tlet i = 0;\n\n\twhile ( i < aKeys.length ) {\n\t\tconst key = aKeys[ i ];\n\t\tconst aValue = a[ key ];\n\n\t\tif (\n\t\t\t// In iterating only the keys of the first object after verifying\n\t\t\t// equal lengths, account for the case that an explicit `undefined`\n\t\t\t// value in the first is implicitly undefined in the second.\n\t\t\t//\n\t\t\t// Example: isShallowEqualObjects( { a: undefined }, { b: 5 } )\n\t\t\t( aValue === undefined && ! b.hasOwnProperty( key ) ) ||\n\t\t\taValue !== b[ key ]\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\ti++;\n\t}\n\n\treturn true;\n}\n"],
|
|
5
|
+
"mappings": "AAae,SAAR,sBACN,GACA,GACU;AACV,MAAK,MAAM,GAAI;AACd,WAAO;AAAA,EACR;AAEA,QAAM,QAAQ,OAAO,KAAM,CAAE;AAC7B,QAAM,QAAQ,OAAO,KAAM,CAAE;AAE7B,MAAK,MAAM,WAAW,MAAM,QAAS;AACpC,WAAO;AAAA,EACR;AAEA,MAAI,IAAI;AAER,SAAQ,IAAI,MAAM,QAAS;AAC1B,UAAM,MAAM,MAAO,CAAE;AACrB,UAAM,SAAS,EAAG,GAAI;AAEtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMG,WAAW,UAAa,CAAE,EAAE,eAAgB,GAAI,KAClD,WAAW,EAAG,GAAI;AAAA,MACjB;AACD,aAAO;AAAA,IACR;AAEA;AAAA,EACD;AAEA,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/is-shallow-equal",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.32.1-next.47f435fc9.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",
|
|
@@ -33,15 +33,20 @@
|
|
|
33
33
|
],
|
|
34
34
|
"main": "build/index.js",
|
|
35
35
|
"module": "build-module/index.js",
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./build-types/index.d.ts",
|
|
39
|
+
"import": "./build-module/index.js",
|
|
40
|
+
"require": "./build/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./package.json": "./package.json"
|
|
43
|
+
},
|
|
36
44
|
"react-native": "src/index",
|
|
37
45
|
"wpScript": true,
|
|
38
46
|
"types": "build-types",
|
|
39
47
|
"sideEffects": false,
|
|
40
|
-
"dependencies": {
|
|
41
|
-
"@babel/runtime": "7.25.7"
|
|
42
|
-
},
|
|
43
48
|
"publishConfig": {
|
|
44
49
|
"access": "public"
|
|
45
50
|
},
|
|
46
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "9720f22c138771d2ed1a0522725c3cdf1c242953"
|
|
47
52
|
}
|