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:
941 bytes
|
Line | |
---|
1 | var serialOrdered = require('../serialOrdered.js');
|
---|
2 |
|
---|
3 | // API
|
---|
4 | module.exports = ReadableSerialOrdered;
|
---|
5 | // expose sort helpers
|
---|
6 | module.exports.ascending = serialOrdered.ascending;
|
---|
7 | module.exports.descending = serialOrdered.descending;
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * Streaming wrapper to `asynckit.serialOrdered`
|
---|
11 | *
|
---|
12 | * @param {array|object} list - array or object (named list) to iterate over
|
---|
13 | * @param {function} iterator - iterator to run
|
---|
14 | * @param {function} sortMethod - custom sort function
|
---|
15 | * @param {function} callback - invoked when all elements processed
|
---|
16 | * @returns {stream.Readable#}
|
---|
17 | */
|
---|
18 | function ReadableSerialOrdered(list, iterator, sortMethod, callback)
|
---|
19 | {
|
---|
20 | if (!(this instanceof ReadableSerialOrdered))
|
---|
21 | {
|
---|
22 | return new ReadableSerialOrdered(list, iterator, sortMethod, callback);
|
---|
23 | }
|
---|
24 |
|
---|
25 | // turn on object mode
|
---|
26 | ReadableSerialOrdered.super_.call(this, {objectMode: true});
|
---|
27 |
|
---|
28 | this._start(serialOrdered, list, iterator, sortMethod, callback);
|
---|
29 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.