You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
29
+
30
+
#### reduce
31
+
32
+
Invoke an async reducer function on each item in the given Array,
33
+
where the reducer transforms an accumulator value based on each item iterated over.
34
+
**Note:** because `reduce()` is order-sensitive, iteration is sequential.
35
+
36
+
> This is an asynchronous version of `Array.prototype.reduce()`
37
+
38
+
**Parameters**
39
+
40
+
-`array`**[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** The Array to reduce
41
+
-`reducer`**[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Async function, gets passed `(accumulator, value, index, array)` and returns a new value for `accumulator`
42
+
-`accumulator`**\[Any]** Optional initial accumulator value
43
+
44
+
**Examples**
45
+
46
+
```javascript
47
+
awaitreduce(
48
+
['/foo', '/bar', '/baz'],
49
+
async (accumulator, value) => {
50
+
accumulator[v] =awaitfetch(value);
51
+
return accumulator;
52
+
},
53
+
{}
54
+
);
55
+
```
56
+
57
+
Returns **any** final `accumulator` value
58
+
59
+
#### map
60
+
61
+
Invoke an async transform function on each item in the given Array **in parallel**,
62
+
returning the resulting Array of mapped/transformed items.
63
+
64
+
> This is an asynchronous, parallelized version of `Array.prototype.map()`.
65
+
66
+
**Parameters**
67
+
68
+
-`array`**[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** The Array to map over
69
+
-`mapper`**[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Async function, gets passed `(value, index, array)`, returns the new value.
Invoke an async filter function on each item in the given Array **in parallel**,
85
+
returning an Array of values for which the filter function returned a truthy value.
86
+
87
+
> This is an asynchronous, parallelized version of `Array.prototype.filter()`.
88
+
89
+
**Parameters**
90
+
91
+
-`array`**[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** The Array to filter
92
+
-`filterer`**[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Async function. Gets passed `(value, index, array)`, returns true to keep the value in the resulting filtered Array.
Invoke all async functions in an Array or Object **in parallel**, returning the result.
108
+
109
+
**Parameters**
110
+
111
+
-`list`**([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)> | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)<[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)>)** Array/Object with values that are async functions to invoke.
112
+
113
+
**Examples**
114
+
115
+
```javascript
116
+
awaitparallel([
117
+
async () =>awaitfetch('foo'),
118
+
async () =>awaitfetch('baz')
119
+
])
120
+
```
121
+
122
+
Returns **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)\|[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))** same structure as `list` input, but with values now resolved.
123
+
124
+
#### series
125
+
126
+
Invoke all async functions in an Array or Object **sequentially**, returning the result.
127
+
128
+
**Parameters**
129
+
130
+
-`list`**([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)> | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)<[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)>)** Array/Object with values that are async functions to invoke.
131
+
132
+
**Examples**
133
+
134
+
```javascript
135
+
awaitseries([
136
+
async () =>awaitfetch('foo'),
137
+
async () =>awaitfetch('baz')
138
+
])
139
+
```
140
+
141
+
Returns **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)\|[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object))** same structure as `list` input, but with values now resolved.
0 commit comments