-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathomit.d.ts
50 lines (50 loc) · 1.11 KB
/
omit.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
export = omit;
/**
* @name omit
*
* @synopsis
* ```coffeescript [specscript]
* omit(paths Array<string>)(source Object) -> omitted Object
*
* omit(source Object, paths Array<string>) -> omitted Object
* ```
*
* @description
* Create a new object by excluding provided paths on a source object.
*
* ```javascript [playground]
* console.log(
* omit({ _id: '1', name: 'George' }, ['_id']),
* ) // { name: 'George' }
* ```
*
* `omit` supports three types of path patterns for nested property access
*
* * dot delimited - `'a.b.c'`
* * bracket notation - `'a[0].value'`
* * an array of keys or indices - `['a', 0, 'value']`
*
* ```javascript [playground]
* console.log(
* omit(['a.b.d'])({
* a: {
* b: {
* c: 'hello',
* d: 'goodbye',
* },
* },
* }),
* ) // { a: { b: { c: 'hello' } } }
* ```
*
* Compose `omit` inside a `pipe` with its lazy API
*
* ```javascript [playground]
* pipe({ a: 1, b: 2, c: 3 }, [
* map(number => number ** 2),
* omit(['a', 'b']),
* console.log, // { c: 9 }
* ])
* ```
*/
declare function omit(arg0: any, arg1: any): any;