main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
655 bytes
|
Rev | Line | |
---|
[d565449] | 1 | var serial = require('../serial.js');
|
---|
| 2 |
|
---|
| 3 | // API
|
---|
| 4 | module.exports = ReadableSerial;
|
---|
| 5 |
|
---|
| 6 | /**
|
---|
| 7 | * Streaming wrapper to `asynckit.serial`
|
---|
| 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 ReadableSerial(list, iterator, callback)
|
---|
| 15 | {
|
---|
| 16 | if (!(this instanceof ReadableSerial))
|
---|
| 17 | {
|
---|
| 18 | return new ReadableSerial(list, iterator, callback);
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | // turn on object mode
|
---|
| 22 | ReadableSerial.super_.call(this, {objectMode: true});
|
---|
| 23 |
|
---|
| 24 | this._start(serial, list, iterator, callback);
|
---|
| 25 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.