@glyph-cat/equality
Version:
Common equality-checking presets for general purpose.
34 lines (29 loc) • 1.53 kB
TypeScript
/**
* Compares each element in the array using [\`Object.is\`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
* @returns `true` if both values are considered equal, otherwise `false`.
* @public
*/
export declare function shallowCompareArray(a: Array<any> | any, b: Array<any> | any): boolean;
/**
* A wrapper around `shallowCompareArray` and `shallowCompareObject`.
* Only use this when you cannot determine whether the values to compare will
* return an array or an object as it exhausts additional computing resources
* that could otherwise be prevented.
* @returns `true` if both values are considered equal, otherwise `false`.
* @public
*/
export declare function shallowCompareArrayOrObject(a: Array<any> | any, b: Array<any> | any): boolean;
/**
* Compares each item in the object using [\`Object.is\`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
* @returns `true` if both values are considered equal, otherwise `false`.
* @public
*/
export declare function shallowCompareObject(a: any, b: any): boolean;
/**
* {:TSDOC_DESC_EQUALITY_STRINGIFY_COMPARE:}
* Compares the values after serializing them with [\`JSON.stringify\`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify).
* @returns `true` if both values are considered equal, otherwise `false`.
* @public
*/
export declare function stringifyCompare(a: any, b: any): boolean;
export { }