typedash
Version:
modern, type-safe collection of utility functions
22 lines (20 loc) • 819 B
TypeScript
/**
* Slimmed down version of https://github.com/planttheidea/fast-equals
* Without all the configuration options, and with a few tweaks to make it more readable (though a bit less performant)
*/
/**
* Compare two values to determine if they are deeply equivalent by value.
* @param value1 The first value to compare.
* @param value2 The second value to compare.
* @returns `true` if the two values are equivalent, `false` otherwise.
* @example
* ```ts
* isEqual(1, 1); // true
* isEqual(1, '1'); // false
* isEqual({ a: 1 }, { a: 1 }); // true
* isEqual({ a: 1 }, { a: 2 }); // false
* isEqual(new Date('2020-01-01'), new Date('2020-01-01')); // true
* isEqual(new Set([1, 2, 3]), new Set([3, 2, 1])); // true
*/
declare const isEqual: <T1, T2>(value1: T1, value2: T2) => boolean;
export { isEqual };