queue.js 626 B

123456789101112131415161718192021222324
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = function (worker, concurrency) {
  6. var _worker = (0, _wrapAsync2.default)(worker);
  7. return (0, _queue2.default)((items, cb) => {
  8. _worker(items[0], cb);
  9. }, concurrency, 1);
  10. };
  11. var _queue = require('./internal/queue.js');
  12. var _queue2 = _interopRequireDefault(_queue);
  13. var _wrapAsync = require('./internal/wrapAsync.js');
  14. var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
  15. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16. module.exports = exports.default;