UNPKG

@signaldb/core

Version:

SignalDB is a client-side database that provides a simple MongoDB-like interface to the data with first-class typescript support to achieve an optimistic UI. Data persistence can be achieved by using storage providers that store the data through a JSON in

31 lines (30 loc) 715 B
function isEqual(a, b) { if (Object.is(a, b)) return true; if (a instanceof RegExp && b instanceof RegExp) return a.toString() === b.toString(); if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime(); if (typeof a !== "object") return false; if (typeof b !== "object") return false; if (a === null) return false; if (b === null) return false; const aKeys = Object.keys(a); const bKeys = Object.keys(b); if (aKeys.length !== bKeys.length) return false; for (const key of aKeys) { if (!bKeys.includes(key)) return false; if (!isEqual(a[key], b[key])) return false; } return true; } export { isEqual as default };