Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = _parallel;
  6. var _noop = require('lodash/noop');
  7. var _noop2 = _interopRequireDefault(_noop);
  8. var _isArrayLike = require('lodash/isArrayLike');
  9. var _isArrayLike2 = _interopRequireDefault(_isArrayLike);
  10. var _slice = require('./slice');
  11. var _slice2 = _interopRequireDefault(_slice);
  12. var _wrapAsync = require('./wrapAsync');
  13. var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
  14. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15. function _parallel(eachfn, tasks, callback) {
  16. callback = callback || _noop2.default;
  17. var results = (0, _isArrayLike2.default)(tasks) ? [] : {};
  18. eachfn(tasks, function (task, key, callback) {
  19. (0, _wrapAsync2.default)(task)(function (err, result) {
  20. if (arguments.length > 2) {
  21. result = (0, _slice2.default)(arguments, 1);
  22. }
  23. results[key] = result;
  24. callback(err);
  25. });
  26. }, function (err) {
  27. callback(err, results);
  28. });
  29. }
  30. module.exports = exports['default'];