Performs a deep equality comparison between two values (including objects) to determine if they are equivalent.
It recursively compares the properties of objects and elements of arrays.
This function handles:
Primitive values (compared with ===)
Plain objects
Arrays
Date objects (compared by their time value)
RegExp objects (compared by their source and flags)
Map and Set objects (compared by their contents)
Plain Old Javascript Objects (POJOs)
Note: For Set and Map objects, a shallow comparison is performed on their contents.
This function does not handle circular references and may lead to a stack overflow with
deeply nested or circular structures. This function is a wrapper around isDeepEqual.
Parameters
x: unknown
The first value to compare.
ref: object
The reference object to compare against.
Returns xisobject
true if the objects are deeply equal, false otherwise.
Performs a deep equality comparison between two values (including objects) to determine if they are equivalent. It recursively compares the properties of objects and elements of arrays.
This function handles:
===)Dateobjects (compared by their time value)RegExpobjects (compared by their source and flags)MapandSetobjects (compared by their contents)Note: For
SetandMapobjects, a shallow comparison is performed on their contents. This function does not handle circular references and may lead to a stack overflow with deeply nested or circular structures. This function is a wrapper aroundisDeepEqual.