-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.d.ts
64 lines (57 loc) · 3.17 KB
/
index.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
interface HashMap {
[key: string]: any;
}
/**
* Function appends props to a nested object in an object or object array.
* If the `source` param is undefined, function returns undefined.
* If the `source` param is not an object, function returns it as is.
* If whether `predicate` or `newProps` param is not an object,
* or the `predicate` object is empty, function returns the unmodified `source`.
*/
export function appendProps(source: any, predicate: HashMap, newProps: HashMap): any;
/**
* Function replaces __all__ props of a nested object in an object or object array.
* If the `source` param is undefined, function returns undefined.
* If the `source` param is not an object, function returns it as is.
* If whether `predicate` or `replaceWith` param is not an object,
* or the `predicate` object is empty, function returns the unmodified `source`.
*/
export function replaceObject(source: any, predicate: HashMap, replaceWith: HashMap): any;
/**
* Function replaces some __existing__ props of a nested object in an object or object array.
* If the `source` param is undefined, function returns undefined.
* If the `source` param is not an object, function returns it as is.
* If whether `predicate` or `replaceProps` param is not an object,
* or the `predicate` object is empty, function returns the unmodified `source`.
*/
export function changeProps(source: any, predicate: HashMap, replaceProps: HashMap): any;
/**
* Function removes a nested object in an object or object array.
* If the `source` param is undefined, function returns undefined.
* If the `source` param is not an object, function returns it as is.
* If the `predicate` param is not an object or it is empty, function returns the unmodified `source`.
*/
export function removeObject(source: any, predicate: HashMap): any;
/**
* Function returns the found object, or an object array if there's more than one object found.
* If the `source` param is undefined, function returns undefined.
* If the `source` param is not an object, function returns it as is.
* If the `predicate` param is not an object, or it's empty, function returns the unmodified `source`.
*/
export function returnFound(source: any, predicate: HashMap): any;
/**
* Function inserts the given `objectToInsert` before the found object if the found object's parent is array.
* If the `source` param is undefined, function returns undefined.
* If the `source` param is not an object, function returns it as is.
* If whether `predicate` or `objectToInsert` param is not an object,
* or the `predicate` object is empty, function returns the unmodified `source`.
*/
export function insertObjectBefore(source: any, predicate: HashMap, objectToInsert: HashMap): any;
/**
* Function inserts the given `objectToInsert` after the found object if the found object's parent is array.
* If the `source` param is undefined, function returns undefined.
* If the `source` param is not an object, function returns it as is.
* If whether `predicate` or `objectToInsert` param is not an object,
* or the `predicate` object is empty, function returns the unmodified `source`.
*/
export function insertObjectAfter(source: any, predicate: HashMap, objectToInsert: HashMap): any;