@prisma-next/utils 0.1.0-dev.28 → 0.1.0-dev.30
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.
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if two arrays are equal using Object.is() for element comparison.
|
|
3
|
+
* Arrays are considered equal if they have the same length and each element
|
|
4
|
+
* at corresponding indices is equal according to Object.is().
|
|
5
|
+
*
|
|
6
|
+
* @param a - First array to compare
|
|
7
|
+
* @param b - Second array to compare
|
|
8
|
+
* @returns true if arrays are equal, false otherwise
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* isArrayEqual(['a', 'b'], ['a', 'b']); // true
|
|
13
|
+
* isArrayEqual(['a'], ['a', 'b']); // false
|
|
14
|
+
* isArrayEqual([0], [-0]); // false (Object.is distinguishes +0 and -0)
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
declare function isArrayEqual<T>(a: readonly T[], b: readonly T[]): boolean;
|
|
18
|
+
|
|
19
|
+
export { isArrayEqual };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/array-equal.ts
|
|
2
|
+
function isArrayEqual(a, b) {
|
|
3
|
+
if (a.length !== b.length) {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
for (let i = 0; i < a.length; i++) {
|
|
7
|
+
if (!Object.is(a[i], b[i])) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
isArrayEqual
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=array-equal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/array-equal.ts"],"sourcesContent":["/**\n * Checks if two arrays are equal using Object.is() for element comparison.\n * Arrays are considered equal if they have the same length and each element\n * at corresponding indices is equal according to Object.is().\n *\n * @param a - First array to compare\n * @param b - Second array to compare\n * @returns true if arrays are equal, false otherwise\n *\n * @example\n * ```typescript\n * isArrayEqual(['a', 'b'], ['a', 'b']); // true\n * isArrayEqual(['a'], ['a', 'b']); // false\n * isArrayEqual([0], [-0]); // false (Object.is distinguishes +0 and -0)\n * ```\n */\nexport function isArrayEqual<T>(a: readonly T[], b: readonly T[]): boolean {\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (!Object.is(a[i], b[i])) {\n return false;\n }\n }\n return true;\n}\n"],"mappings":";AAgBO,SAAS,aAAgB,GAAiB,GAA0B;AACzE,MAAI,EAAE,WAAW,EAAE,QAAQ;AACzB,WAAO;AAAA,EACT;AACA,WAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,KAAK;AACjC,QAAI,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG;AAC1B,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/utils",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.30",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "Shared utility functions for Prisma Next",
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"exports": {
|
|
18
|
+
"./array-equal": {
|
|
19
|
+
"types": "./dist/exports/array-equal.d.ts",
|
|
20
|
+
"import": "./dist/exports/array-equal.js"
|
|
21
|
+
},
|
|
18
22
|
"./defined": {
|
|
19
23
|
"types": "./dist/exports/defined.d.ts",
|
|
20
24
|
"import": "./dist/exports/defined.js"
|