1var serialOrdered = require('../serialOrdered.js'); 2 3// API 4module.exports = ReadableSerialOrdered; 5// expose sort helpers 6module.exports.ascending = serialOrdered.ascending; 7module.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 */ 18function 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} 30