UNPKG

@naverpay/hidash

Version:
37 lines (36 loc) 940 B
function i(e, t) { if (typeof e == "number" && typeof t == "number" && isNaN(e) && isNaN(t) || e === t) return !0; if (typeof e == "object" && e !== null && typeof t == "object" && t !== null) { if (Object.getPrototypeOf(e) !== Object.getPrototypeOf(t)) return !1; if (e instanceof Map && t instanceof Map) { if (e.size !== t.size) return !1; for (const [f, o] of e) if (!t.has(f) || !i(o, t.get(f))) return !1; return !0; } if (e instanceof Set && t instanceof Set) { if (e.size !== t.size) return !1; for (const f of e) if (!t.has(f)) return !1; return !0; } const n = e, s = t, r = Object.keys(n), c = Object.keys(s); if (r.length !== c.length) return !1; for (const f of r) if (!i(n[f], s[f])) return !1; return !0; } return !1; } export { i as default, i as isEqual };