Approach request optimization differently

This commit is contained in:
Jon Staab
2024-09-03 17:30:11 -07:00
parent 6ee79eb219
commit 06d3462f99
6 changed files with 100 additions and 85 deletions
+13
View File
@@ -197,6 +197,19 @@ export const isPojo = (obj: any) => {
export const equals = (a: any, b: any) => {
if (a === b) return true
if (a instanceof Set && b instanceof Set) {
a = Array.from(a)
b = Array.from(b)
}
if (a instanceof Set) {
if (!(b instanceof Set) || a.size !== b.size) {
return false
}
return Array.from(a).every(x => b.has(x))
}
if (Array.isArray(a)) {
if (!Array.isArray(b) || a.length !== b.length) {
return false