UNPKG

@glyph-cat/equality

Version:
62 lines (51 loc) 2.24 kB
import { BuildType } from '@glyph-cat/foundation'; /** * 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 arrayIsShallowEqual(a: Array<any> | any, b: Array<any> | any): boolean; /** * A wrapper around {@link arrayIsShallowEqual|`arrayIsShallowEqual`} and * {@link objectIsShallowEqual|`objectIsShallowEqual`}. * * 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 arrayOrObjectIsShallowEqual(a: Array<any> | any, b: Array<any> | any): boolean; /** * Git commit hash of which the package was built. * @public */ export declare const BUILD_HASH: string; /** * The package build type. * @public */ export declare const BUILD_TYPE: BuildType; export declare function isCaseInsensitiveEqual(a: any, b: any): boolean; /** * Performs an equality check using `JSON.stringify`. * Compares the values after serializing them with [`JSON.stringify`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). * @param a - The first item to compare. * @param b - The second item to compare. * @returns `true` if both values are considered equal, otherwise `false`. * @public */ export declare function isJSONequal(a: any, b: any): b is typeof a; export declare function isLocaleCaseInsensitiveEqual(a: any, b: any, locales?: Intl.LocalesArgument): 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 objectIsShallowEqual(a: any, b: any): boolean; /** * The package version. * @public */ export declare const VERSION: string | undefined; export { }