@stdlib/utils-async-every-by 0.0.8 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,16 +16,16 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- // TypeScript Version: 2.0
19
+ // TypeScript Version: 4.1
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
- interface Options {
28
+ interface Options<T, V> {
29
29
  /**
30
30
  * The maximum number of pending invocations at any one time.
31
31
  */
@@ -39,7 +39,7 @@ interface Options {
39
39
  /**
40
40
  * Execution context.
41
41
  */
42
- thisArg?: any;
42
+ thisArg?: ThisParameterType<Predicate<T, V>>;
43
43
  }
44
44
 
45
45
  /**
@@ -76,7 +76,7 @@ type Callback = Nullary | Unary | Binary;
76
76
  * @param value - collection value
77
77
  * @param next - callback which should be called once the predicate function has finished processing a collection value
78
78
  */
79
- type BinaryPredicate = ( value: any, next: Callback ) => void;
79
+ type BinaryPredicate<T, V> = ( this: V, value: T, next: Callback ) => void;
80
80
 
81
81
  /**
82
82
  * Checks whether an element in a collection passes a test.
@@ -85,7 +85,7 @@ type BinaryPredicate = ( value: any, next: Callback ) => void;
85
85
  * @param index - collection index
86
86
  * @param next - callback which should be called once the `predicate` function has finished processing a collection `value`
87
87
  */
88
- type TernaryPredicate = ( value: any, index: number, next: Callback ) => void;
88
+ type TernaryPredicate<T, V> = ( this: V, value: T, index: number, next: Callback ) => void;
89
89
 
90
90
  /**
91
91
  * Checks whether an element in a collection passes a test.
@@ -95,7 +95,7 @@ type TernaryPredicate = ( value: any, index: number, next: Callback ) => void;
95
95
  * @param collection - input collection
96
96
  * @param next - callback which should be called once the `predicate` function has finished processing a collection `value`
97
97
  */
98
- type QuaternaryPredicate = ( value: any, index: number, collection: Collection, next: Callback ) => void; // tslint-disable-line max-line-length
98
+ type QuaternaryPredicate<T, V> = ( this: V, value: T, index: number, collection: Collection<T>, next: Callback ) => void;
99
99
 
100
100
  /**
101
101
  * Checks whether an element in a collection passes a test.
@@ -105,15 +105,15 @@ type QuaternaryPredicate = ( value: any, index: number, collection: Collection,
105
105
  * @param collection - input collection
106
106
  * @param next - callback which should be called once the `predicate` function has finished processing a collection `value`
107
107
  */
108
- type Predicate = BinaryPredicate | TernaryPredicate | QuaternaryPredicate;
108
+ type Predicate<T, V> = BinaryPredicate<T, V> | TernaryPredicate<T, V> | QuaternaryPredicate<T, V>;
109
109
 
110
110
  /**
111
- * Tests whether all elements in a collection pass a test implemented by a predicate function.
111
+ * Tests whether all elements in a collection passes a test implemented by a predicate function.
112
112
  *
113
113
  * @param collection - input collection
114
114
  * @param done - function to invoke upon completion
115
115
  */
116
- type FactoryFunction = ( collection: Collection, done: Callback ) => void;
116
+ type FactoryFunction<T> = ( collection: Collection<T>, done: Callback ) => void;
117
117
 
118
118
  /**
119
119
  * Interface for `everyByAsync`.
@@ -127,7 +127,6 @@ interface EveryByAsync {
127
127
  * - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
128
128
  * - 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`).
129
129
  *
130
- *
131
130
  * @param collection - input collection
132
131
  * @param options - function options
133
132
  * @param options.thisArg - execution context
@@ -138,7 +137,7 @@ interface EveryByAsync {
138
137
  * @throws must provide valid options
139
138
  *
140
139
  * @example
141
- * var readFile = require( `@stdlib/fs/read-file` );
140
+ * var readFile = require( '@stdlib/fs-read-file' );
142
141
  *
143
142
  * function done( error, bool ) {
144
143
  * if ( error ) {
@@ -172,7 +171,7 @@ interface EveryByAsync {
172
171
  *
173
172
  * everyByAsync( files, predicate, done );
174
173
  */
175
- ( collection: Collection, options: Options, predicate: Predicate, done: Callback ): void; // tslint-disable-line max-line-length
174
+ <T = unknown, V = unknown>( collection: Collection<T>, options: Options<T, V>, predicate: Predicate<T, V>, done: Callback ): void;
176
175
 
177
176
  /**
178
177
  * Tests whether all elements in a collection pass a test implemented by a predicate function.
@@ -182,14 +181,13 @@ interface EveryByAsync {
182
181
  * - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
183
182
  * - 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`).
184
183
  *
185
- *
186
184
  * @param collection - input collection
187
185
  * @param predicate - predicate function to invoke for each element in a collection
188
186
  * @param done - function to invoke upon completion
189
187
  * @throws must provide valid options
190
188
  *
191
189
  * @example
192
- * var readFile = require( `@stdlib/fs/read-file` );
190
+ * var readFile = require( '@stdlib/fs-read-file' );
193
191
  *
194
192
  * function done( error, bool ) {
195
193
  * if ( error ) {
@@ -223,7 +221,7 @@ interface EveryByAsync {
223
221
  *
224
222
  * everyByAsync( files, predicate, done );
225
223
  */
226
- ( collection: Collection, predicate: Predicate, done: Callback ): void;
224
+ <T = unknown, V = unknown>( collection: Collection<T>, predicate: Predicate<T, V>, done: Callback ): void;
227
225
 
228
226
  /**
229
227
  * Returns a function for testing whether all elements in a collection pass a test implemented by a predicate function.
@@ -233,7 +231,6 @@ interface EveryByAsync {
233
231
  * - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
234
232
  * - 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`).
235
233
  *
236
- *
237
234
  * @param options - function options
238
235
  * @param options.thisArg - execution context
239
236
  * @param options.limit - maximum number of pending invocations at any one time
@@ -243,7 +240,7 @@ interface EveryByAsync {
243
240
  * @returns function which invokes the predicate function once for each element in a collection
244
241
  *
245
242
  * @example
246
- * var readFile = require( `@stdlib/fs/read-file` );
243
+ * var readFile = require( '@stdlib/fs-read-file' );
247
244
  *
248
245
  * function predicate( file, next ) {
249
246
  * var opts = {
@@ -287,7 +284,7 @@ interface EveryByAsync {
287
284
  * // Try to read each element in `files`:
288
285
  * everyByAsync( files, done );
289
286
  */
290
- factory( options: Options, predicate: Predicate ): FactoryFunction;
287
+ factory<T = unknown, V = unknown>( options: Options<T, V>, predicate: Predicate<T, V> ): FactoryFunction<T>;
291
288
 
292
289
  /**
293
290
  * Returns a function for testing whether all elements in a collection pass a test implemented by a predicate function.
@@ -297,13 +294,12 @@ interface EveryByAsync {
297
294
  * - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
298
295
  * - 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`).
299
296
  *
300
- *
301
297
  * @param predicate - predicate function to invoke for each element in a collection
302
298
  * @throws must provide valid options
303
299
  * @returns function which invokes the predicate function once for each element in a collection
304
300
  *
305
301
  * @example
306
- * var readFile = require( `@stdlib/fs/read-file` );
302
+ * var readFile = require( '@stdlib/fs-read-file' );
307
303
  *
308
304
  * function predicate( file, next ) {
309
305
  * var opts = {
@@ -347,7 +343,7 @@ interface EveryByAsync {
347
343
  * // Try to read each element in `files`:
348
344
  * everyByAsync( files, done );
349
345
  */
350
- factory( predicate: Predicate ): FactoryFunction;
346
+ factory<T = unknown, V = unknown>( predicate: Predicate<T, V> ): FactoryFunction<T>;
351
347
  }
352
348
 
353
349
  /**
@@ -358,7 +354,6 @@ interface EveryByAsync {
358
354
  * - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
359
355
  * - 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`).
360
356
  *
361
- *
362
357
  * @param collection - input collection
363
358
  * @param options - function options
364
359
  * @param options.thisArg - execution context
@@ -369,7 +364,7 @@ interface EveryByAsync {
369
364
  * @throws must provide valid options
370
365
  *
371
366
  * @example
372
- * var readFile = require( `@stdlib/fs/read-file` );
367
+ * var readFile = require( '@stdlib/fs-read-file' );
373
368
  *
374
369
  * function done( error, bool ) {
375
370
  * if ( error ) {
package/lib/factory.js CHANGED
@@ -23,6 +23,7 @@
23
23
  var isFunction = require( '@stdlib/assert-is-function' );
24
24
  var isCollection = require( '@stdlib/assert-is-collection' );
25
25
  var PINF = require( '@stdlib/constants-float64-pinf' );
26
+ var format = require( '@stdlib/string-format' );
26
27
  var validate = require( './validate.js' );
27
28
  var limit = require( './limit.js' );
28
29
 
@@ -37,7 +38,6 @@ var limit = require( './limit.js' );
37
38
  * - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
38
39
  * - 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`).
39
40
  *
40
- *
41
41
  * @param {Options} [options] - function options
42
42
  * @param {*} [options.thisArg] - execution context
43
43
  * @param {PositiveInteger} [options.limit] - maximum number of pending invocations at any one time
@@ -109,7 +109,7 @@ function factory( options, predicate ) {
109
109
  f = options;
110
110
  }
111
111
  if ( !isFunction( f ) ) {
112
- throw new TypeError( 'invalid argument. Last argument must be a function. Value: `'+f+'`.' );
112
+ throw new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', f ) );
113
113
  }
114
114
  if ( opts.series ) {
115
115
  opts.limit = 1;
@@ -130,10 +130,10 @@ function factory( options, predicate ) {
130
130
  */
131
131
  function everyByAsync( collection, done ) {
132
132
  if ( !isCollection( collection ) ) {
133
- throw new TypeError( 'invalid argument. First argument must be a collection. Value: `'+collection+'.`' );
133
+ throw new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );
134
134
  }
135
135
  if ( !isFunction( done ) ) {
136
- throw new TypeError( 'invalid argument. Last argument must be a function. Value: `'+done+'`.' );
136
+ throw new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', done ) );
137
137
  }
138
138
  return limit( collection, opts, f, clbk );
139
139
 
package/lib/index.js CHANGED
@@ -63,15 +63,15 @@
63
63
  // MODULES //
64
64
 
65
65
  var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );
66
- var everyByAsync = require( './every_by.js' );
66
+ var main = require( './main.js' );
67
67
  var factory = require( './factory.js' );
68
68
 
69
69
 
70
70
  // MAIN //
71
71
 
72
- setReadOnly( everyByAsync, 'factory', factory );
72
+ setReadOnly( main, 'factory', factory );
73
73
 
74
74
 
75
75
  // EXPORTS //
76
76
 
77
- module.exports = everyByAsync;
77
+ module.exports = main;
@@ -33,7 +33,6 @@ var factory = require( './factory.js' );
33
33
  * - If a predicate function calls the provided callback with a truthy error argument, the function suspends execution and immediately calls the `done` callback for subsequent error handling.
34
34
  * - 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`).
35
35
  *
36
- *
37
36
  * @param {Collection} collection - input collection
38
37
  * @param {Options} [options] - function options
39
38
  * @param {*} [options.thisArg] - execution context
package/lib/validate.js CHANGED
@@ -24,6 +24,7 @@ var isObject = require( '@stdlib/assert-is-plain-object' );
24
24
  var hasOwnProp = require( '@stdlib/assert-has-own-property' );
25
25
  var isBoolean = require( '@stdlib/assert-is-boolean' ).isPrimitive;
26
26
  var isPositiveInteger = require( '@stdlib/assert-is-positive-integer' ).isPrimitive;
27
+ var format = require( '@stdlib/string-format' );
27
28
 
28
29
 
29
30
  // MAIN //
@@ -53,7 +54,7 @@ var isPositiveInteger = require( '@stdlib/assert-is-positive-integer' ).isPrimit
53
54
  */
54
55
  function validate( opts, options ) {
55
56
  if ( !isObject( options ) ) {
56
- return new TypeError( 'invalid argument. Options must be an object. Value: `' + options + '`.' );
57
+ return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
57
58
  }
58
59
  if ( hasOwnProp( options, 'thisArg' ) ) {
59
60
  opts.thisArg = options.thisArg;
@@ -61,13 +62,13 @@ function validate( opts, options ) {
61
62
  if ( hasOwnProp( options, 'series' ) ) {
62
63
  opts.series = options.series;
63
64
  if ( !isBoolean( opts.series ) ) {
64
- return new TypeError( 'invalid option. `series` option must be a boolean primitive. Option: `' + opts.series + '`.' );
65
+ return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'series', opts.series ) );
65
66
  }
66
67
  }
67
68
  if ( hasOwnProp( options, 'limit' ) ) {
68
69
  opts.limit = options.limit;
69
70
  if ( !isPositiveInteger( opts.limit ) ) {
70
- return new TypeError( 'invalid option. `limit` option must be a positive integer. Option: `' + opts.limit + '`.' );
71
+ return new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );
71
72
  }
72
73
  }
73
74
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/utils-async-every-by",
3
- "version": "0.0.8",
3
+ "version": "0.2.0",
4
4
  "description": "Test whether all elements in a collection pass a test implemented by a predicate function.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -37,24 +37,27 @@
37
37
  "url": "https://github.com/stdlib-js/stdlib/issues"
38
38
  },
39
39
  "dependencies": {
40
- "@stdlib/assert-has-own-property": "^0.0.x",
41
- "@stdlib/assert-is-boolean": "^0.0.x",
42
- "@stdlib/assert-is-collection": "^0.0.x",
43
- "@stdlib/assert-is-function": "^0.0.x",
44
- "@stdlib/assert-is-plain-object": "^0.0.x",
45
- "@stdlib/assert-is-positive-integer": "^0.0.x",
46
- "@stdlib/constants-float64-pinf": "^0.0.x",
47
- "@stdlib/types": "^0.0.x",
48
- "@stdlib/utils-define-nonenumerable-read-only-property": "^0.0.x",
49
- "debug": "^2.6.9"
40
+ "@stdlib/assert-has-own-property": "^0.1.1",
41
+ "@stdlib/assert-is-boolean": "^0.2.0",
42
+ "@stdlib/assert-is-collection": "^0.2.0",
43
+ "@stdlib/assert-is-function": "^0.2.0",
44
+ "@stdlib/assert-is-plain-object": "^0.2.0",
45
+ "@stdlib/assert-is-positive-integer": "^0.2.0",
46
+ "@stdlib/constants-float64-pinf": "^0.2.0",
47
+ "@stdlib/string-format": "^0.2.0",
48
+ "@stdlib/types": "^0.3.1",
49
+ "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.0",
50
+ "debug": "^2.6.9",
51
+ "@stdlib/error-tools-fmtprodmsg": "^0.1.1"
50
52
  },
51
53
  "devDependencies": {
52
- "@stdlib/bench": "^0.0.x",
53
- "@stdlib/fs-read-file": "^0.0.x",
54
- "@stdlib/utils-noop": "^0.0.x",
54
+ "@stdlib/fs-read-file": "^0.1.1",
55
+ "@stdlib/utils-noop": "^0.2.0",
55
56
  "tape": "git+https://github.com/kgryte/tape.git#fix/globby",
56
57
  "istanbul": "^0.4.1",
57
- "tap-spec": "5.x.x"
58
+ "tap-min": "git+https://github.com/Planeshifter/tap-min.git",
59
+ "@stdlib/bench-harness": "^0.1.2",
60
+ "@stdlib/bench": "^0.3.1"
58
61
  },
59
62
  "engines": {
60
63
  "node": ">=0.10.0",
@@ -92,7 +95,7 @@
92
95
  "validate"
93
96
  ],
94
97
  "funding": {
95
- "type": "patreon",
96
- "url": "https://www.patreon.com/athan"
98
+ "type": "opencollective",
99
+ "url": "https://opencollective.com/stdlib"
97
100
  }
98
101
  }
package/docs/repl.txt DELETED
@@ -1,209 +0,0 @@
1
-
2
- {{alias}}( collection, [options,] predicate, done )
3
- Tests whether all elements in a collection pass a test implemented by a
4
- predicate function.
5
-
6
- When invoked, the predicate function is provided a maximum of four
7
- arguments:
8
-
9
- - `value`: collection value
10
- - `index`: collection index
11
- - `collection`: the input collection
12
- - `next`: a callback to be invoked after processing a collection `value`
13
-
14
- The actual number of provided arguments depends on function length. If the
15
- predicate function accepts two arguments, the predicate function is
16
- provided:
17
-
18
- - `value`
19
- - `next`
20
-
21
- If the predicate function accepts three arguments, the predicate function is
22
- provided:
23
-
24
- - `value`
25
- - `index`
26
- - `next`
27
-
28
- For every other predicate function signature, the predicate function is
29
- provided all four arguments.
30
-
31
- The `next` callback takes two arguments:
32
-
33
- - `error`: error argument
34
- - `result`: test result
35
-
36
- If a provided function calls the `next` callback with a truthy `error`
37
- argument, the function suspends execution and immediately calls the `done`
38
- callback for subsequent `error` handling.
39
-
40
- The function immediately returns upon encountering a non-truthy `result`
41
- value and calls the `done` callback with `null` as the first argument and
42
- `false` as the second argument.
43
-
44
- If all elements succeed, the function calls the `done` callback with `null`
45
- as the first argument and `true` as the second argument.
46
-
47
- Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony,
48
- wrap the `done` callback in a function which either executes at the end of
49
- the current stack (e.g., `nextTick`) or during a subsequent turn of the
50
- event loop (e.g., `setImmediate`, `setTimeout`).
51
-
52
- The function does not support dynamic collection resizing.
53
-
54
- The function does not skip `undefined` elements.
55
-
56
- Parameters
57
- ----------
58
- collection: Array|TypedArray|Object
59
- Input collection over which to iterate. If provided an object, the
60
- object must be array-like (excluding strings and functions).
61
-
62
- options: Object (optional)
63
- Function options.
64
-
65
- options.limit: integer (optional)
66
- Maximum number of pending invocations. Default: Infinity.
67
-
68
- options.series: boolean (optional)
69
- Boolean indicating whether to process each collection element
70
- sequentially. Default: false.
71
-
72
- options.thisArg: any (optional)
73
- Execution context.
74
-
75
- predicate: Function
76
- The test function to invoke for each element in a collection.
77
-
78
- done: Function
79
- A callback invoked either upon processing all collection elements or
80
- upon encountering an error.
81
-
82
- Examples
83
- --------
84
- // Basic usage:
85
- > function predicate( value, next ) {
86
- ... setTimeout( onTimeout, value );
87
- ... function onTimeout() {
88
- ... console.log( value );
89
- ... next( null, true );
90
- ... }
91
- ... };
92
- > function done( error, bool ) {
93
- ... if ( error ) {
94
- ... throw error;
95
- ... }
96
- ... console.log( bool );
97
- ... };
98
- > var arr = [ 3000, 2500, 1000 ];
99
- > {{alias}}( arr, predicate, done )
100
- 1000
101
- 2500
102
- 3000
103
- true
104
-
105
- // Limit number of concurrent invocations:
106
- > function predicate( value, next ) {
107
- ... setTimeout( onTimeout, value );
108
- ... function onTimeout() {
109
- ... console.log( value );
110
- ... next( null, true );
111
- ... }
112
- ... };
113
- > function done( error, bool ) {
114
- ... if ( error ) {
115
- ... throw error;
116
- ... }
117
- ... console.log( bool );
118
- ... };
119
- > var opts = { 'limit': 2 };
120
- > var arr = [ 3000, 2500, 1000 ];
121
- > {{alias}}( arr, opts, predicate, done )
122
- 2500
123
- 3000
124
- 1000
125
- true
126
-
127
- // Process sequentially:
128
- > function predicate( value, next ) {
129
- ... setTimeout( onTimeout, value );
130
- ... function onTimeout() {
131
- ... console.log( value );
132
- ... next( null, true );
133
- ... }
134
- ... };
135
- > function done( error, bool ) {
136
- ... if ( error ) {
137
- ... throw error;
138
- ... }
139
- ... console.log( bool );
140
- ... };
141
- > var opts = { 'series': true };
142
- > var arr = [ 3000, 2500, 1000 ];
143
- > {{alias}}( arr, opts, predicate, done )
144
- 3000
145
- 2500
146
- 1000
147
- true
148
-
149
-
150
- {{alias}}.factory( [options,] predicate )
151
- Returns a function which tests whether all elements in a collection pass a
152
- test implemented by a predicate function.
153
-
154
- Parameters
155
- ----------
156
- options: Object (optional)
157
- Function options.
158
-
159
- options.limit: integer (optional)
160
- Maximum number of pending invocations. Default: Infinity.
161
-
162
- options.series: boolean (optional)
163
- Boolean indicating whether to process each collection element
164
- sequentially. Default: false.
165
-
166
- options.thisArg: any (optional)
167
- Execution context.
168
-
169
- predicate: Function
170
- The test function to invoke for each element in a collection.
171
-
172
- Returns
173
- -------
174
- out: Function
175
- A function which tests each element in a collection.
176
-
177
- Examples
178
- --------
179
- > function predicate( value, next ) {
180
- ... setTimeout( onTimeout, value );
181
- ... function onTimeout() {
182
- ... console.log( value );
183
- ... next( null, true );
184
- ... }
185
- ... };
186
- > var opts = { 'series': true };
187
- > var f = {{alias}}.factory( opts, predicate );
188
- > function done( error, bool ) {
189
- ... if ( error ) {
190
- ... throw error;
191
- ... }
192
- ... console.log( bool );
193
- ... };
194
- > var arr = [ 3000, 2500, 1000 ];
195
- > f( arr, done )
196
- 3000
197
- 2500
198
- 1000
199
- true
200
- > arr = [ 2000, 1500, 1000 ];
201
- > f( arr, done )
202
- 2000
203
- 1500
204
- 1000
205
- true
206
-
207
- See Also
208
- --------
209
-