@@ -22,19 +22,27 @@ const typedKeys = <T extends object>(obj: Readonly<T>): readonly (keyof T)[] =>
2222} ;
2323
2424/**
25- * Performs a deep equality check between two values.
25+ * Performs a deep comparison between two values to determine if they are equivalent .
2626 *
27- * This function compares primitive types, arrays, plain objects, Date instances,
28- * and RegExp objects. It returns true if the values are deeply equal, false otherwise.
27+ * Handles comparison for:
28+ * - Primitives (`number`, `string`, `boolean`, `null`, `undefined`, `symbol`, `bigint`)
29+ * - `NaN` (considers `NaN` equal to `NaN`)
30+ * - Arrays (including sparse arrays)
31+ * - Plain objects (including nested structures)
32+ * - `Date` objects (compared by timestamp)
33+ * - `RegExp` objects (compared by pattern and flags)
34+ * - Symbols (only same references are equal)
35+ * - Functions (only same references are equal)
2936 *
30- * - Uses `Object.is` for primitive comparison (handles `NaN`, `-0`, etc.)
31- * - Recursively checks array contents and object properties
32- * - Properly compares Date and RegExp objects
33- * - Returns false for functions, symbols, maps, sets, or class instances (not handled)
37+ * Returns false for:
38+ * - Differing types
39+ * - Different array orders or lengths
40+ * - Objects with different keys or values
41+ * - Mismatched sparse vs dense arrays
3442 *
3543 * @param a - The first value to compare.
3644 * @param b - The second value to compare.
37- * @returns `true` if values are deeply equal, `false` otherwise .
45+ * @returns `true` if the values are deeply equal, otherwise `false`.
3846 */
3947export const equal = ( a : unknown , b : unknown ) : boolean => {
4048 if ( Object . is ( a , b ) ) {
0 commit comments