-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathforEach.d.ts
35 lines (35 loc) · 958 Bytes
/
forEach.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
export = forEach;
/**
* @name forEach
*
* @synopsis
* ```coffeescript [specscript]
* type Collection = Array|Iterable|AsyncIterable|{ forEach: function }|Object
*
* forEach(collection Collection, callback function) -> collection Collection
*
* forEach(callback function)(collection Collection) -> collection Collection
* ```
*
* @description
* Execute a callback for each item of a collection, returning a Promise if the execution is asynchronous.
*
* ```javascript [playground]
* forEach([1, 2, 3, 4, 5l], console.log) // 1 2 3 4 5
*
* forEach({ a: 1, b: 2, c: 3 }, console.log) // 1 2 3
* ```
*
* Omit the data argument for a composable API
*
* ```javascript [playground]
* pipe([1, 2, 3, 4, 5], [
* filter(number => number % 2 == 1),
* map(number => number ** 2),
* forEach(console.log), // 1
* // 9
* // 25
* ])
* ```
*/
declare function forEach(...args: any[]): any;