You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
673 B

  1. var parallel = require('../parallel.js');
  2. // API
  3. module.exports = ReadableParallel;
  4. /**
  5. * Streaming wrapper to `asynckit.parallel`
  6. *
  7. * @param {array|object} list - array or object (named list) to iterate over
  8. * @param {function} iterator - iterator to run
  9. * @param {function} callback - invoked when all elements processed
  10. * @returns {stream.Readable#}
  11. */
  12. function ReadableParallel(list, iterator, callback)
  13. {
  14. if (!(this instanceof ReadableParallel))
  15. {
  16. return new ReadableParallel(list, iterator, callback);
  17. }
  18. // turn on object mode
  19. ReadableParallel.super_.call(this, {objectMode: true});
  20. this._start(parallel, list, iterator, callback);
  21. }