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
<imgsrc="https://i.imgur.com/yiiq6Gx.png"width="275"alt="Asyncro Example 2">
16
16
17
-
18
-
---
17
+
* * *
19
18
20
19
## Installation
21
20
@@ -40,7 +39,7 @@ async function example() {
40
39
41
40
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
42
41
43
-
####reduce
42
+
### reduce
44
43
45
44
Invoke an async reducer function on each item in the given Array,
46
45
where the reducer transforms an accumulator value based on each item iterated over.
@@ -50,9 +49,9 @@ where the reducer transforms an accumulator value based on each item iterated ov
50
49
51
50
**Parameters**
52
51
53
-
-`array`**[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** The Array to reduce
54
-
-`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`
55
-
-`accumulator`**\[Any]** Optional initial accumulator value
52
+
-`array`**[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** The Array to reduce
53
+
-`reducer`**[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Async function, gets passed `(accumulator, value, index, array)` and returns a new value for `accumulator`
54
+
-`accumulator`**any?** Optional initial accumulator value
56
55
57
56
**Examples**
58
57
@@ -69,7 +68,7 @@ await reduce(
69
68
70
69
Returns **any** final `accumulator` value
71
70
72
-
####map
71
+
### map
73
72
74
73
Invoke an async transform function on each item in the given Array **in parallel**,
75
74
returning the resulting Array of mapped/transformed items.
@@ -78,8 +77,8 @@ returning the resulting Array of mapped/transformed items.
78
77
79
78
**Parameters**
80
79
81
-
-`array`**[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** The Array to map over
82
-
-`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.
80
+
-`array`**[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** The Array to map over
81
+
-`mapper`**[Function](https://developer.mozilla.org/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**,
98
97
returning an Array of values for which the filter function returned a truthy value.
@@ -101,8 +100,8 @@ returning an Array of values for which the filter function returned a truthy val
101
100
102
101
**Parameters**
103
102
104
-
-`array`**[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** The Array to filter
105
-
-`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.
103
+
-`array`**[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** The Array to filter
104
+
-`filterer`**[Function](https://developer.mozilla.org/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 an async function on each item in the given Array **in parallel**,
120
+
returning the first element predicate returns truthy for.
121
+
122
+
> This is an asynchronous, parallelized version of `Array.prototype.find()`.
123
+
124
+
**Parameters**
125
+
126
+
-`array`**[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** The Array to find
127
+
-`predicate`**[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Async function. Gets passed `(value, index, array)`, returns true to be the find result.
128
+
129
+
**Examples**
130
+
131
+
```javascript
132
+
awaitfind(
133
+
['foo', 'baz', 'root'],
134
+
asyncv=> (awaitfetch(v)).name==='baz'
135
+
)
136
+
```
137
+
138
+
Returns **any** resulting find value
139
+
140
+
### every
141
+
142
+
Checks if predicate returns truthy for **all** elements of collection **in parallel**.
143
+
144
+
> This is an asynchronous, parallelized version of `Array.prototype.every()`.
145
+
146
+
**Parameters**
147
+
148
+
-`array`**[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** The Array to iterate over.
149
+
-`predicate`**[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Async function. Gets passed `(value, index, array)`, The function invoked per iteration.
150
+
151
+
**Examples**
152
+
153
+
```javascript
154
+
awaitevery(
155
+
[2, 3],
156
+
asyncv=> (awaitfetch(v)).ok
157
+
)
158
+
```
159
+
160
+
Returns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns true if **all** element passes the predicate check, else false.
161
+
162
+
### some
163
+
164
+
Checks if predicate returns truthy for **any** element of collection **in parallel**.
165
+
166
+
> This is an asynchronous, parallelized version of `Array.prototype.some()`.
167
+
168
+
**Parameters**
169
+
170
+
-`array`**[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** The Array to iterate over.
171
+
-`filterer`**[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Async function. Gets passed `(value, index, array)`, The function invoked per iteration.
172
+
173
+
**Examples**
174
+
175
+
```javascript
176
+
awaitsome(
177
+
['foo', 'baz'],
178
+
asyncv=> (awaitfetch(v)).ok
179
+
)
180
+
```
181
+
182
+
Returns **[Boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns true if **any** element passes the predicate check, else false.
117
183
118
-
####parallel
184
+
### parallel
119
185
120
186
Invoke all async functions in an Array or Object **in parallel**, returning the result.
121
187
122
188
**Parameters**
123
189
124
-
-`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.
190
+
-`list`**([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)> | [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)<[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)>)** Array/Object with values that are async functions to invoke.
125
191
126
192
**Examples**
127
193
@@ -132,15 +198,15 @@ await parallel([
132
198
])
133
199
```
134
200
135
-
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.
201
+
Returns **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\|[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** same structure as `list` input, but with values now resolved.
136
202
137
-
####series
203
+
### series
138
204
139
205
Invoke all async functions in an Array or Object **sequentially**, returning the result.
140
206
141
207
**Parameters**
142
208
143
-
-`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.
209
+
-`list`**([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)> | [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)<[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)>)** Array/Object with values that are async functions to invoke.
144
210
145
211
**Examples**
146
212
@@ -151,4 +217,4 @@ await series([
151
217
])
152
218
```
153
219
154
-
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.
220
+
Returns **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\|[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** same structure as `list` input, but with values now resolved.
0 commit comments