@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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 5.32.0 (2025-10-01)
6
+
5
7
  ## 5.31.0 (2025-09-17)
6
8
 
7
9
  ## 5.30.0 (2025-09-03)
package/build/arrays.js CHANGED
@@ -1,17 +1,26 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
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.default = isShallowEqualArrays;
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
@@ -1 +1,7 @@
1
- {"version":3,"names":["isShallowEqualArrays","a","b","length","i","len"],"sources":["@wordpress/is-shallow-equal/src/arrays.ts"],"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"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,oBAAoBA,CAC3CC,CAAY,EACZC,CAAY,EACF;EACV,IAAKD,CAAC,KAAKC,CAAC,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,IAAKD,CAAC,CAACE,MAAM,KAAKD,CAAC,CAACC,MAAM,EAAG;IAC5B,OAAO,KAAK;EACb;EAEA,KAAM,IAAIC,CAAC,GAAG,CAAC,EAAEC,GAAG,GAAGJ,CAAC,CAACE,MAAM,EAAEC,CAAC,GAAGC,GAAG,EAAED,CAAC,EAAE,EAAG;IAC/C,IAAKH,CAAC,CAAEG,CAAC,CAAE,KAAKF,CAAC,CAAEE,CAAC,CAAE,EAAG;MACxB,OAAO,KAAK;IACb;EACD;EAEA,OAAO,IAAI;AACZ","ignoreList":[]}
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 _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = isShallowEqual;
8
- Object.defineProperty(exports, "isShallowEqualArrays", {
9
- enumerable: true,
10
- get: function () {
11
- return _arrays.default;
12
- }
13
- });
14
- Object.defineProperty(exports, "isShallowEqualObjects", {
15
- enumerable: true,
16
- get: function () {
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
- var _objects = _interopRequireDefault(require("./objects"));
21
- var _arrays = _interopRequireDefault(require("./arrays"));
22
- /**
23
- * Internal dependencies
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, _objects.default)(a, b);
43
+ return (0, import_objects.default)(a, b);
39
44
  } else if (Array.isArray(a) && Array.isArray(b)) {
40
- return (0, _arrays.default)(a, b);
45
+ return (0, import_arrays.default)(a, b);
41
46
  }
42
47
  }
43
48
  return a === b;
44
49
  }
45
- //# sourceMappingURL=index.js.map
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
@@ -1 +1,7 @@
1
- {"version":3,"names":["_objects","_interopRequireDefault","require","_arrays","isShallowEqual","a","b","constructor","Object","isShallowEqualObjects","Array","isArray","isShallowEqualArrays"],"sources":["@wordpress/is-shallow-equal/src/index.ts"],"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"],"mappings":";;;;;;;;;;;;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,cAAcA,CAAEC,CAAU,EAAEC,CAAU,EAAY;EACzE,IAAKD,CAAC,IAAIC,CAAC,EAAG;IACb,IAAKD,CAAC,CAACE,WAAW,KAAKC,MAAM,IAAIF,CAAC,CAACC,WAAW,KAAKC,MAAM,EAAG;MAC3D,OAAO,IAAAC,gBAAqB,EAAEJ,CAAC,EAAEC,CAAE,CAAC;IACrC,CAAC,MAAM,IAAKI,KAAK,CAACC,OAAO,CAAEN,CAAE,CAAC,IAAIK,KAAK,CAACC,OAAO,CAAEL,CAAE,CAAC,EAAG;MACtD,OAAO,IAAAM,eAAoB,EAAEP,CAAC,EAAEC,CAAE,CAAC;IACpC;EACD;EAEA,OAAOD,CAAC,KAAKC,CAAC;AACf","ignoreList":[]}
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.defineProperty(exports, "__esModule", {
4
- value: true
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.default = isShallowEqualObjects;
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
- // In iterating only the keys of the first object after verifying
34
- // equal lengths, account for the case that an explicit `undefined`
35
- // value in the first is implicitly undefined in the second.
36
- //
37
- // Example: isShallowEqualObjects( { a: undefined }, { b: 5 } )
38
- aValue === undefined && !b.hasOwnProperty(key) || aValue !== b[key]) {
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
@@ -1 +1,7 @@
1
- {"version":3,"names":["isShallowEqualObjects","a","b","aKeys","Object","keys","bKeys","length","i","key","aValue","undefined","hasOwnProperty"],"sources":["@wordpress/is-shallow-equal/src/objects.ts"],"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"],"mappings":";;;;;;AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,qBAAqBA,CAC5CC,CAAmB,EACnBC,CAAmB,EACT;EACV,IAAKD,CAAC,KAAKC,CAAC,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,MAAMC,KAAK,GAAGC,MAAM,CAACC,IAAI,CAAEJ,CAAE,CAAC;EAC9B,MAAMK,KAAK,GAAGF,MAAM,CAACC,IAAI,CAAEH,CAAE,CAAC;EAE9B,IAAKC,KAAK,CAACI,MAAM,KAAKD,KAAK,CAACC,MAAM,EAAG;IACpC,OAAO,KAAK;EACb;EAEA,IAAIC,CAAC,GAAG,CAAC;EAET,OAAQA,CAAC,GAAGL,KAAK,CAACI,MAAM,EAAG;IAC1B,MAAME,GAAG,GAAGN,KAAK,CAAEK,CAAC,CAAE;IACtB,MAAME,MAAM,GAAGT,CAAC,CAAEQ,GAAG,CAAE;IAEvB;IACC;IACA;IACA;IACA;IACA;IACEC,MAAM,KAAKC,SAAS,IAAI,CAAET,CAAC,CAACU,cAAc,CAAEH,GAAI,CAAC,IACnDC,MAAM,KAAKR,CAAC,CAAEO,GAAG,CAAE,EAClB;MACD,OAAO,KAAK;IACb;IAEAD,CAAC,EAAE;EACJ;EAEA,OAAO,IAAI;AACZ","ignoreList":[]}
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
+ }
@@ -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
- //# sourceMappingURL=arrays.js.map
15
+ export {
16
+ isShallowEqualArrays as default
17
+ };
18
+ //# sourceMappingURL=arrays.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["isShallowEqualArrays","a","b","length","i","len"],"sources":["@wordpress/is-shallow-equal/src/arrays.ts"],"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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,oBAAoBA,CAC3CC,CAAY,EACZC,CAAY,EACF;EACV,IAAKD,CAAC,KAAKC,CAAC,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,IAAKD,CAAC,CAACE,MAAM,KAAKD,CAAC,CAACC,MAAM,EAAG;IAC5B,OAAO,KAAK;EACb;EAEA,KAAM,IAAIC,CAAC,GAAG,CAAC,EAAEC,GAAG,GAAGJ,CAAC,CAACE,MAAM,EAAEC,CAAC,GAAGC,GAAG,EAAED,CAAC,EAAE,EAAG;IAC/C,IAAKH,CAAC,CAAEG,CAAC,CAAE,KAAKF,CAAC,CAAEE,CAAC,CAAE,EAAG;MACxB,OAAO,KAAK;IACb;EACD;EAEA,OAAO,IAAI;AACZ","ignoreList":[]}
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
+ }
@@ -1,20 +1,8 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import isShallowEqualObjects from './objects';
5
- import isShallowEqualArrays from './arrays';
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
- //# sourceMappingURL=index.js.map
15
+ export {
16
+ isShallowEqual as default,
17
+ default3 as isShallowEqualArrays,
18
+ default2 as isShallowEqualObjects
19
+ };
20
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["isShallowEqualObjects","isShallowEqualArrays","default","isShallowEqual","a","b","constructor","Object","Array","isArray"],"sources":["@wordpress/is-shallow-equal/src/index.ts"],"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"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,qBAAqB,MAAM,WAAW;AAC7C,OAAOC,oBAAoB,MAAM,UAAU;AAE3C,SAASC,OAAO,IAAIF,qBAAqB,QAAQ,WAAW;AAC5D,SAASE,OAAO,IAAID,oBAAoB,QAAQ,UAAU;AAI1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASE,cAAcA,CAAEC,CAAU,EAAEC,CAAU,EAAY;EACzE,IAAKD,CAAC,IAAIC,CAAC,EAAG;IACb,IAAKD,CAAC,CAACE,WAAW,KAAKC,MAAM,IAAIF,CAAC,CAACC,WAAW,KAAKC,MAAM,EAAG;MAC3D,OAAOP,qBAAqB,CAAEI,CAAC,EAAEC,CAAE,CAAC;IACrC,CAAC,MAAM,IAAKG,KAAK,CAACC,OAAO,CAAEL,CAAE,CAAC,IAAII,KAAK,CAACC,OAAO,CAAEJ,CAAE,CAAC,EAAG;MACtD,OAAOJ,oBAAoB,CAAEG,CAAC,EAAEC,CAAE,CAAC;IACpC;EACD;EAEA,OAAOD,CAAC,KAAKC,CAAC;AACf","ignoreList":[]}
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
+ }
@@ -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
- // In iterating only the keys of the first object after verifying
28
- // equal lengths, account for the case that an explicit `undefined`
29
- // value in the first is implicitly undefined in the second.
30
- //
31
- // Example: isShallowEqualObjects( { a: undefined }, { b: 5 } )
32
- aValue === undefined && !b.hasOwnProperty(key) || aValue !== b[key]) {
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
- //# sourceMappingURL=objects.js.map
28
+ export {
29
+ isShallowEqualObjects as default
30
+ };
31
+ //# sourceMappingURL=objects.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["isShallowEqualObjects","a","b","aKeys","Object","keys","bKeys","length","i","key","aValue","undefined","hasOwnProperty"],"sources":["@wordpress/is-shallow-equal/src/objects.ts"],"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"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,qBAAqBA,CAC5CC,CAAmB,EACnBC,CAAmB,EACT;EACV,IAAKD,CAAC,KAAKC,CAAC,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,MAAMC,KAAK,GAAGC,MAAM,CAACC,IAAI,CAAEJ,CAAE,CAAC;EAC9B,MAAMK,KAAK,GAAGF,MAAM,CAACC,IAAI,CAAEH,CAAE,CAAC;EAE9B,IAAKC,KAAK,CAACI,MAAM,KAAKD,KAAK,CAACC,MAAM,EAAG;IACpC,OAAO,KAAK;EACb;EAEA,IAAIC,CAAC,GAAG,CAAC;EAET,OAAQA,CAAC,GAAGL,KAAK,CAACI,MAAM,EAAG;IAC1B,MAAME,GAAG,GAAGN,KAAK,CAAEK,CAAC,CAAE;IACtB,MAAME,MAAM,GAAGT,CAAC,CAAEQ,GAAG,CAAE;IAEvB;IACC;IACA;IACA;IACA;IACA;IACEC,MAAM,KAAKC,SAAS,IAAI,CAAET,CAAC,CAACU,cAAc,CAAEH,GAAI,CAAC,IACnDC,MAAM,KAAKR,CAAC,CAAEO,GAAG,CAAE,EAClB;MACD,OAAO,KAAK;IACb;IAEAD,CAAC,EAAE;EACJ;EAEA,OAAO,IAAI;AACZ","ignoreList":[]}
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.31.1-next.f56bd8138.0",
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": "ea4a281fd857f48338877590de8c8eb9b9a8cef4"
51
+ "gitHead": "9720f22c138771d2ed1a0522725c3cdf1c242953"
47
52
  }