DB Docs
API Reference
- Core API Reference
- Collection
- createCollection
- liveQueryCollectionOptions
- createLiveQueryCollection
- createOptimisticAction
- createTransaction
- Electric DB Collection
- electricCollectionOptions
- Query DB Collection
- queryCollectionOptions
- RxDB DB Collection
- rxdbCollectionOptions
- PowerSync Collection
- powerSyncCollectionOptions
- createIndexedDB
- indexedDBCollectionOptions
- React Hooks
- useLiveQuery
AI/LLM: This documentation page is available in plain markdown format at/db/latest/docs/reference/functions/deepEquals.md
deepEquals
ts
function deepEquals(a, b): boolean;Defined in: packages/db/src/utils.ts:46
Deep equality function that compares two values recursively Handles primitives, objects, arrays, Date, RegExp, Map, Set, TypedArrays, and Temporal objects Plain records can compare by keys with keyed class instances and records from other realms.
Parameters#
a#
any
First value to compare
b#
any
Second value to compare
Returns#
boolean
True if the values are deeply equal, false otherwise
Example#
ts
deepEquals({ a: 1, b: 2 }, { b: 2, a: 1 }) // true (property order doesn't matter)
deepEquals([1, { x: 2 }], [1, { x: 2 }]) // true
deepEquals({ a: 1 }, { a: 2 }) // false
deepEquals(new Date('2023-01-01'), new Date('2023-01-01')) // true
deepEquals(new Map([['a', 1]]), new Map([['a', 1]])) // true