UNPKG

@maz-ui/utils

Version:

Utils of maz-ui for JavaScript/TypeScript users

27 lines (26 loc) 849 B
function i(e) { return e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "symbol" || typeof e == "bigint"; } function o(e, r) { if (e.length !== r.length) return !1; for (const [t, n] of e.entries()) if (!s(n, r[t])) return !1; return !0; } function y(e, r) { const t = Object.keys(e), n = Object.keys(r); if (t.length !== n.length) return !1; for (const f of t) if (!n.includes(f) || !s(e[f], r[f])) return !1; return !0; } function s(e, r) { return i(e) || i(r) ? e === r : e instanceof Date && r instanceof Date ? e.getTime() === r.getTime() : typeof e != typeof r || Array.isArray(e) !== Array.isArray(r) ? !1 : Array.isArray(e) && Array.isArray(r) ? o(e, r) : typeof e == "object" && typeof r == "object" ? y(e, r) : !1; } export { s as isEqual };