UNPKG

1.76 kBTypeScriptView Raw
1/** @deprecated use IKeyAllowlist */
2export declare type IKeyWhitelist<T> = IKeyAllowlist<T>;
3/** @deprecated use IKeyDenylist */
4export declare type IKeyBlacklist<T> = IKeyDenylist<T>;
5/** @deprecated use KeyAllowlist */
6export interface IKeyAllowlist<T> {
7 include: Array<keyof T>;
8}
9export declare type KeyAllowlist<T> = IKeyAllowlist<T>;
10/** @deprecated use KeyDenylist */
11export interface IKeyDenylist<T> {
12 exclude: Array<keyof T>;
13}
14export declare type KeyDenylist<T> = IKeyDenylist<T>;
15/**
16 * Returns true if the arrays are equal. Elements will be shallowly compared by
17 * default, or they will be compared using the custom `compare` function if one
18 * is provided.
19 */
20export declare function arraysEqual(arrA: any[], arrB: any[], compare?: (a: any, b: any) => boolean): boolean;
21/**
22 * Shallow comparison between objects. If `keys` is provided, just that subset
23 * of keys will be compared; otherwise, all keys will be compared.
24 *
25 * @returns true if items are equal.
26 */
27export declare function shallowCompareKeys<T extends {}>(objA: T, objB: T, keys?: KeyDenylist<T> | KeyAllowlist<T>): boolean;
28/**
29 * Deep comparison between objects. If `keys` is provided, just that subset of
30 * keys will be compared; otherwise, all keys will be compared.
31 *
32 * @returns true if items are equal.
33 */
34export declare function deepCompareKeys(objA: any, objB: any, keys?: Array<string | number | symbol>): boolean;
35/**
36 * Returns a descriptive object for each key whose values are deeply unequal
37 * between two provided objects. Useful for debugging shouldComponentUpdate.
38 */
39export declare function getDeepUnequalKeyValues<T extends {}>(objA?: T, objB?: T, keys?: Array<keyof T>): {
40 key: keyof T;
41 valueA: T[keyof T];
42 valueB: T[keyof T];
43}[];