@wordpress/is-shallow-equal 4.30.0 → 4.32.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,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 4.32.0 (2023-04-26)
6
+
7
+ ## 4.31.0 (2023-04-12)
8
+
5
9
  ## 4.30.0 (2023-03-29)
6
10
 
7
11
  ## 4.29.0 (2023-03-15)
package/build/index.js CHANGED
@@ -33,10 +33,10 @@ var _arrays = _interopRequireDefault(require("./arrays"));
33
33
 
34
34
  /**
35
35
  * Returns true if the two arrays or objects are shallow equal, or false
36
- * otherwise.
36
+ * otherwise. Also handles primitive values, just in case.
37
37
  *
38
- * @param {any[]|ComparableObject} a First object or array to compare.
39
- * @param {any[]|ComparableObject} b Second object or array to compare.
38
+ * @param {unknown} a First object or array to compare.
39
+ * @param {unknown} b Second object or array to compare.
40
40
  *
41
41
  * @return {boolean} Whether the two values are shallow equal.
42
42
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/is-shallow-equal/src/index.js"],"names":["isShallowEqual","a","b","constructor","Object","Array","isArray"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAOA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,cAAT,CAAyBC,CAAzB,EAA4BC,CAA5B,EAAgC;AAC9C,MAAKD,CAAC,IAAIC,CAAV,EAAc;AACb,QAAKD,CAAC,CAACE,WAAF,KAAkBC,MAAlB,IAA4BF,CAAC,CAACC,WAAF,KAAkBC,MAAnD,EAA4D;AAC3D,aAAO,sBAAuBH,CAAvB,EAA0BC,CAA1B,CAAP;AACA,KAFD,MAEO,IAAKG,KAAK,CAACC,OAAN,CAAeL,CAAf,KAAsBI,KAAK,CAACC,OAAN,CAAeJ,CAAf,CAA3B,EAAgD;AACtD,aAAO,qBAAsBD,CAAtB,EAAyBC,CAAzB,CAAP;AACA;AACD;;AAED,SAAOD,CAAC,KAAKC,CAAb;AACA","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\n/**\n * @typedef {Record<string, any>} ComparableObject\n */\n\n/**\n * Returns true if the two arrays or objects are shallow equal, or false\n * otherwise.\n *\n * @param {any[]|ComparableObject} a First object or array to compare.\n * @param {any[]|ComparableObject} b Second object or array to compare.\n *\n * @return {boolean} Whether the two values are shallow equal.\n */\nexport default function isShallowEqual( a, b ) {\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"]}
1
+ {"version":3,"sources":["@wordpress/is-shallow-equal/src/index.js"],"names":["isShallowEqual","a","b","constructor","Object","Array","isArray"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAOA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,cAAT,CAAyBC,CAAzB,EAA4BC,CAA5B,EAAgC;AAC9C,MAAKD,CAAC,IAAIC,CAAV,EAAc;AACb,QAAKD,CAAC,CAACE,WAAF,KAAkBC,MAAlB,IAA4BF,CAAC,CAACC,WAAF,KAAkBC,MAAnD,EAA4D;AAC3D,aAAO,sBAAuBH,CAAvB,EAA0BC,CAA1B,CAAP;AACA,KAFD,MAEO,IAAKG,KAAK,CAACC,OAAN,CAAeL,CAAf,KAAsBI,KAAK,CAACC,OAAN,CAAeJ,CAAf,CAA3B,EAAgD;AACtD,aAAO,qBAAsBD,CAAtB,EAAyBC,CAAzB,CAAP;AACA;AACD;;AAED,SAAOD,CAAC,KAAKC,CAAb;AACA","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\n/**\n * @typedef {Record<string, any>} ComparableObject\n */\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 {unknown} a First object or array to compare.\n * @param {unknown} b Second object or array to compare.\n *\n * @return {boolean} Whether the two values are shallow equal.\n */\nexport default function isShallowEqual( a, b ) {\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"]}
@@ -11,10 +11,10 @@ export { default as isShallowEqualArrays } from './arrays';
11
11
 
12
12
  /**
13
13
  * Returns true if the two arrays or objects are shallow equal, or false
14
- * otherwise.
14
+ * otherwise. Also handles primitive values, just in case.
15
15
  *
16
- * @param {any[]|ComparableObject} a First object or array to compare.
17
- * @param {any[]|ComparableObject} b Second object or array to compare.
16
+ * @param {unknown} a First object or array to compare.
17
+ * @param {unknown} b Second object or array to compare.
18
18
  *
19
19
  * @return {boolean} Whether the two values are shallow equal.
20
20
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/is-shallow-equal/src/index.js"],"names":["isShallowEqualObjects","isShallowEqualArrays","default","isShallowEqual","a","b","constructor","Object","Array","isArray"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,qBAAP,MAAkC,WAAlC;AACA,OAAOC,oBAAP,MAAiC,UAAjC;AAEA,SAASC,OAAO,IAAIF,qBAApB,QAAiD,WAAjD;AACA,SAASE,OAAO,IAAID,oBAApB,QAAgD,UAAhD;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASE,cAAT,CAAyBC,CAAzB,EAA4BC,CAA5B,EAAgC;AAC9C,MAAKD,CAAC,IAAIC,CAAV,EAAc;AACb,QAAKD,CAAC,CAACE,WAAF,KAAkBC,MAAlB,IAA4BF,CAAC,CAACC,WAAF,KAAkBC,MAAnD,EAA4D;AAC3D,aAAOP,qBAAqB,CAAEI,CAAF,EAAKC,CAAL,CAA5B;AACA,KAFD,MAEO,IAAKG,KAAK,CAACC,OAAN,CAAeL,CAAf,KAAsBI,KAAK,CAACC,OAAN,CAAeJ,CAAf,CAA3B,EAAgD;AACtD,aAAOJ,oBAAoB,CAAEG,CAAF,EAAKC,CAAL,CAA3B;AACA;AACD;;AAED,SAAOD,CAAC,KAAKC,CAAb;AACA","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\n/**\n * @typedef {Record<string, any>} ComparableObject\n */\n\n/**\n * Returns true if the two arrays or objects are shallow equal, or false\n * otherwise.\n *\n * @param {any[]|ComparableObject} a First object or array to compare.\n * @param {any[]|ComparableObject} b Second object or array to compare.\n *\n * @return {boolean} Whether the two values are shallow equal.\n */\nexport default function isShallowEqual( a, b ) {\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"]}
1
+ {"version":3,"sources":["@wordpress/is-shallow-equal/src/index.js"],"names":["isShallowEqualObjects","isShallowEqualArrays","default","isShallowEqual","a","b","constructor","Object","Array","isArray"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,qBAAP,MAAkC,WAAlC;AACA,OAAOC,oBAAP,MAAiC,UAAjC;AAEA,SAASC,OAAO,IAAIF,qBAApB,QAAiD,WAAjD;AACA,SAASE,OAAO,IAAID,oBAApB,QAAgD,UAAhD;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASE,cAAT,CAAyBC,CAAzB,EAA4BC,CAA5B,EAAgC;AAC9C,MAAKD,CAAC,IAAIC,CAAV,EAAc;AACb,QAAKD,CAAC,CAACE,WAAF,KAAkBC,MAAlB,IAA4BF,CAAC,CAACC,WAAF,KAAkBC,MAAnD,EAA4D;AAC3D,aAAOP,qBAAqB,CAAEI,CAAF,EAAKC,CAAL,CAA5B;AACA,KAFD,MAEO,IAAKG,KAAK,CAACC,OAAN,CAAeL,CAAf,KAAsBI,KAAK,CAACC,OAAN,CAAeJ,CAAf,CAA3B,EAAgD;AACtD,aAAOJ,oBAAoB,CAAEG,CAAF,EAAKC,CAAL,CAA3B;AACA;AACD;;AAED,SAAOD,CAAC,KAAKC,CAAb;AACA","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\n/**\n * @typedef {Record<string, any>} ComparableObject\n */\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 {unknown} a First object or array to compare.\n * @param {unknown} b Second object or array to compare.\n *\n * @return {boolean} Whether the two values are shallow equal.\n */\nexport default function isShallowEqual( a, b ) {\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"]}
@@ -3,14 +3,14 @@
3
3
  */
4
4
  /**
5
5
  * Returns true if the two arrays or objects are shallow equal, or false
6
- * otherwise.
6
+ * otherwise. Also handles primitive values, just in case.
7
7
  *
8
- * @param {any[]|ComparableObject} a First object or array to compare.
9
- * @param {any[]|ComparableObject} b Second object or array to compare.
8
+ * @param {unknown} a First object or array to compare.
9
+ * @param {unknown} b Second object or array to compare.
10
10
  *
11
11
  * @return {boolean} Whether the two values are shallow equal.
12
12
  */
13
- export default function isShallowEqual(a: any[] | ComparableObject, b: any[] | ComparableObject): boolean;
13
+ export default function isShallowEqual(a: unknown, b: unknown): boolean;
14
14
  export { default as isShallowEqualObjects } from "./objects";
15
15
  export { default as isShallowEqualArrays } from "./arrays";
16
16
  export type ComparableObject = Record<string, any>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AASA;;GAEG;AAEH;;;;;;;;GAQG;AACH,0CALW,GAAG,EAAE,GAAC,gBAAgB,KACtB,GAAG,EAAE,GAAC,gBAAgB,GAErB,OAAO,CAYlB;;;+BAtBY,OAAO,MAAM,EAAE,GAAG,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AASA;;GAEG;AAEH;;;;;;;;GAQG;AACH,0CALW,OAAO,KACP,OAAO,GAEN,OAAO,CAYlB;;;+BAtBY,OAAO,MAAM,EAAE,GAAG,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/is-shallow-equal",
3
- "version": "4.30.0",
3
+ "version": "4.32.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",
@@ -41,5 +41,5 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "d5c28a67b11e91e3e4b8e90346bfcb90909364d6"
44
+ "gitHead": "6df0c62d43b8901414ccd22ffbe56eaa99d012a6"
45
45
  }
package/src/index.js CHANGED
@@ -13,10 +13,10 @@ export { default as isShallowEqualArrays } from './arrays';
13
13
 
14
14
  /**
15
15
  * Returns true if the two arrays or objects are shallow equal, or false
16
- * otherwise.
16
+ * otherwise. Also handles primitive values, just in case.
17
17
  *
18
- * @param {any[]|ComparableObject} a First object or array to compare.
19
- * @param {any[]|ComparableObject} b Second object or array to compare.
18
+ * @param {unknown} a First object or array to compare.
19
+ * @param {unknown} b Second object or array to compare.
20
20
  *
21
21
  * @return {boolean} Whether the two values are shallow equal.
22
22
  */