@zag-js/utils
Advanced tools
Comparing version 0.0.0-dev-20240615014318 to 0.0.0-dev-20240616132821
@@ -118,2 +118,9 @@ "use strict"; | ||
var isArrayLike = (value) => value?.constructor.name === "Array"; | ||
var isArrayEqual = (a, b) => { | ||
if (a.length !== b.length) return false; | ||
for (let i = 0; i < a.length; i++) { | ||
if (!isEqual(a[i], b[i])) return false; | ||
} | ||
return true; | ||
}; | ||
var isEqual = (a, b) => { | ||
@@ -129,3 +136,3 @@ if (Object.is(a, b)) return true; | ||
if (isArrayLike(a) && isArrayLike(b)) { | ||
return Array.from(a).toString() === Array.from(b).toString(); | ||
return isArrayEqual(Array.from(a), Array.from(b)); | ||
} | ||
@@ -132,0 +139,0 @@ if (!(typeof a === "object") || !(typeof b === "object")) return false; |
{ | ||
"name": "@zag-js/utils", | ||
"version": "0.0.0-dev-20240615014318", | ||
"version": "0.0.0-dev-20240616132821", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
const isArrayLike = (value: any) => value?.constructor.name === "Array" | ||
const isArrayEqual = (a: any[], b: any[]): boolean => { | ||
if (a.length !== b.length) return false | ||
for (let i = 0; i < a.length; i++) { | ||
if (!isEqual(a[i], b[i])) return false | ||
} | ||
return true | ||
} | ||
export const isEqual = (a: any, b: any): boolean => { | ||
@@ -17,3 +25,3 @@ if (Object.is(a, b)) return true | ||
if (isArrayLike(a) && isArrayLike(b)) { | ||
return Array.from(a).toString() === Array.from(b).toString() | ||
return isArrayEqual(Array.from(a), Array.from(b)) | ||
} | ||
@@ -20,0 +28,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
57305
810