Last change
on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
673 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var parallel = require('../parallel.js');
|
---|
| 2 |
|
---|
| 3 | // API
|
---|
| 4 | module.exports = ReadableParallel;
|
---|
| 5 |
|
---|
| 6 | /**
|
---|
| 7 | * Streaming wrapper to `asynckit.parallel`
|
---|
| 8 | *
|
---|
| 9 | * @param {array|object} list - array or object (named list) to iterate over
|
---|
| 10 | * @param {function} iterator - iterator to run
|
---|
| 11 | * @param {function} callback - invoked when all elements processed
|
---|
| 12 | * @returns {stream.Readable#}
|
---|
| 13 | */
|
---|
| 14 | function ReadableParallel(list, iterator, callback)
|
---|
| 15 | {
|
---|
| 16 | if (!(this instanceof ReadableParallel))
|
---|
| 17 | {
|
---|
| 18 | return new ReadableParallel(list, iterator, callback);
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | // turn on object mode
|
---|
| 22 | ReadableParallel.super_.call(this, {objectMode: true});
|
---|
| 23 |
|
---|
| 24 | this._start(parallel, list, iterator, callback);
|
---|
| 25 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.