@wordpress/is-shallow-equal 5.33.1 → 5.34.1-next.2f1c7c01b.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 +2 -0
- package/build/arrays.js.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/objects.js +2 -0
- package/build/objects.js.map +1 -1
- package/build-module/arrays.js +1 -0
- package/build-module/arrays.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/objects.js +1 -0
- package/build-module/objects.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/build/arrays.js
CHANGED
|
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/is-shallow-equal/src/arrays.ts
|
|
19
21
|
var arrays_exports = {};
|
|
20
22
|
__export(arrays_exports, {
|
|
21
23
|
default: () => isShallowEqualArrays
|
package/build/arrays.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/arrays.ts"],
|
|
4
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": "
|
|
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
6
|
"names": []
|
|
7
7
|
}
|
package/build/index.js
CHANGED
|
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/is-shallow-equal/src/index.ts
|
|
29
31
|
var index_exports = {};
|
|
30
32
|
__export(index_exports, {
|
|
31
33
|
default: () => isShallowEqual,
|
package/build/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
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": "
|
|
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
6
|
"names": ["import_objects", "import_arrays", "isShallowEqualObjects", "isShallowEqualArrays"]
|
|
7
7
|
}
|
package/build/objects.js
CHANGED
|
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/is-shallow-equal/src/objects.ts
|
|
19
21
|
var objects_exports = {};
|
|
20
22
|
__export(objects_exports, {
|
|
21
23
|
default: () => isShallowEqualObjects
|
package/build/objects.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/objects.ts"],
|
|
4
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": "
|
|
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
6
|
"names": []
|
|
7
7
|
}
|
package/build-module/arrays.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/arrays.ts"],
|
|
4
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;",
|
|
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
6
|
"names": []
|
|
7
7
|
}
|
package/build-module/index.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
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;",
|
|
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
6
|
"names": ["default"]
|
|
7
7
|
}
|
package/build-module/objects.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/objects.ts"],
|
|
4
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;",
|
|
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
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/is-shallow-equal",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.34.1-next.2f1c7c01b.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",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "c6ddcdf455bc02567a2c9e03de6862a2061b85e8"
|
|
52
52
|
}
|