-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobject.d.ts
45 lines (45 loc) · 1.78 KB
/
object.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
*
* @param {Object} obj
* @returns {string}
*/
export function objectToString(obj: any): string;
/**
* deepEqual - Compare two objects for equality by comparing their string representations
* @param {Object} a - The first object
* @param {Object} b - The second object
* @returns {boolean} - True if the objects are equal, false otherwise
*/
export function deepEqual(a: any, b: any): boolean;
/**
* keyEqual - Compare two objects for equality by comparing their keys
* @param {Object} a - The first object
* @param {Object} b - The second object
* @returns {boolean} - True if the objects have the same keys, false otherwise
*/
export function keyEqual(a: any, b: any): boolean;
/**
* valueEqual - Compare two objects for equality by comparing their values
* @param {Object} a - The first object
* @param {Object} b - The second object
* @returns {boolean} - True if the objects have the same values, false otherwise
* @note This function is not very useful, as it depends upon the ordering of values in the object to be the same. This is not guaranteed in JavaScript. I guess.
*/
export function valueEqual(a: any, b: any): boolean;
/**
* findKeys - Find all keys, even nested, for a given value
* @param {Object} options - The options for finding keys
* @param {Object} options.obj - The object to search
* @param {*} options.value - The value to find
* @param {string} [options.separator='.'] - The separator to use for nested keys
* @param {string[]} [options.keys=[]] - The array to store the keys
* @param {number} [options.depth=9] - The maximum depth to search
* @returns {string[]} - An array of keys that match the given value
*/
export function findKeys(options: {
obj: any;
value: any;
separator?: string;
keys?: string[];
depth?: number;
}): string[];