(a: unknown, b: unknown): boolean import {deep_equal} from '@fuzdev/fuz_util/deep_equal.js'; Deep equality comparison that checks both structure and type.
Key behaviors:
- Compares by constructor to prevent type confusion (security:
{}≠[],{}≠new Map(),new ClassA()≠new ClassB()) - Prevents asymmetry bugs:
deep_equal(a, b)always equalsdeep_equal(b, a) - Compares only enumerable own properties (ignores prototypes, symbols, non-enumerable)
- Special handling for: Date (timestamp), Number/Boolean (boxed primitives), Error (message/name + enumerable own properties)
- Promises always return false (cannot be meaningfully compared)
- Maps/Sets compare by reference for object keys/values
a
type
unknownb
type
unknownreturns
boolean true if deeply equal, false otherwise