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
-`limit`: the maximum number of pending invocations at any one time. If provided, the function sets `options.series=false`. Default: `infinity`.
106
-
-`series`: `boolean` indicating whether to sequentially invoke `reducer` for each `collection` element. If `true`, the function sets `options.limit=1`. Default: `true`.
107
-
-`thisArg`: the execution context for `reducer`.
105
+
-**limit**: the maximum number of pending invocations at any one time. If provided, the function sets `options.series=false`. Default: `infinity`.
106
+
-**series**: boolean indicating whether to sequentially invoke `reducer` for each `collection` element. If `true`, the function sets `options.limit=1`. Default: `true`.
107
+
-**thisArg**: the execution context for `reducer`.
108
108
109
109
By default, all elements are processed **sequentially**, which means that the function **does** guarantee completion order. To process each `collection` element concurrently, set the `series` option to `false`.
110
110
@@ -224,11 +224,11 @@ function done( error, acc ) {
224
224
225
225
When invoked, `reducer` is provided a maximum of five arguments:
226
226
227
-
-`accumulator`: accumulated value.
228
-
-`value`: collection value.
229
-
-`index`: collection index.
230
-
-`collection`: the input `collection`.
231
-
-`next`: a callback which should be called once `reducer` has finished processing a collection `value`.
227
+
-**accumulator**: accumulated value.
228
+
-**value**: collection value.
229
+
-**index**: collection index.
230
+
-**collection**: the input `collection`.
231
+
-**next**: a callback which should be called once `reducer` has finished processing a collection `value`.
232
232
233
233
The actual number of provided arguments depends on function `length`. If `reducer` accepts three arguments, `reducer` is provided `accumulator`, `value` and `next`. If `reducer` accepts four arguments, `reducer` is provided `accumulator`, `value`, `index`, and `next`. For every other `reducer` signature, `reducer` is provided all five arguments.
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/utils/async/reduce-right/docs/types/index.d.ts
+19-24
Original file line number
Diff line number
Diff line change
@@ -20,26 +20,26 @@
20
20
21
21
/// <reference types="@stdlib/types"/>
22
22
23
-
import{Collection}from'@stdlib/types/object';
23
+
import{Collection}from'@stdlib/types/array';
24
24
25
25
/**
26
26
* Interface defining function options.
27
27
*/
28
-
interfaceOptions{
28
+
interfaceOptions<T,U,V>{
29
29
/**
30
-
* The maximum number of pending invocations at any one time.
30
+
* Execution context.
31
31
*/
32
-
limit?: number;
32
+
thisArg?: ThisParameterType<Reducer<T,U,V>>;
33
33
34
34
/**
35
-
* Boolean indicating whether to wait for a previous invocation to complete before invoking a provided function for the next element in a collection (default: true).
35
+
* The maximum number of pending invocations at any one time.
36
36
*/
37
-
series?: boolean;
37
+
limit?: number;
38
38
39
39
/**
40
-
* Execution context.
40
+
* Boolean indicating whether to sequentially invoke the reducer function for each `collection` element. If `true`, the function sets `options.limit=1`. Default: true.
* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
133
133
* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
* Applies a function against an accumulator and each element in a collection and return the accumulated result, iterating from right to left.
@@ -187,7 +186,6 @@ interface ReduceRightAsync {
187
186
* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
188
187
* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
* Returns a function to apply a function against an accumulator and each element in a collection and return the accumulated result, iterating from right to left.
@@ -242,7 +240,6 @@ interface ReduceRightAsync {
242
240
* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
243
241
* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
244
242
*
245
-
*
246
243
* @param options - function options
247
244
* @param options.thisArg - execution context
248
245
* @param options.limit - maximum number of pending invocations at any one time
* Returns a function to apply a function against an accumulator and each element in a collection and return the accumulated result, iterating from right to left.
@@ -306,7 +303,6 @@ interface ReduceRightAsync {
306
303
* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
307
304
* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
308
305
*
309
-
*
310
306
* @param reducer - function to invoke for each element in a collection
311
307
* @returns function which invokes the provided function once for each element in a collection
* - If a provided function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
363
359
* - This function does **not** guarantee that execution is asynchronous. To do so, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`).
0 commit comments