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.

581 lines
19 KiB

4 years ago
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.wrapSync = exports.selectSeries = exports.selectLimit = exports.select = exports.foldr = exports.foldl = exports.inject = exports.forEachOfLimit = exports.forEachOfSeries = exports.forEachOf = exports.forEachLimit = exports.forEachSeries = exports.forEach = exports.findSeries = exports.findLimit = exports.find = exports.anySeries = exports.anyLimit = exports.any = exports.allSeries = exports.allLimit = exports.all = exports.whilst = exports.waterfall = exports.until = exports.unmemoize = exports.tryEach = exports.transform = exports.timesSeries = exports.timesLimit = exports.times = exports.timeout = exports.sortBy = exports.someSeries = exports.someLimit = exports.some = exports.setImmediate = exports.series = exports.seq = exports.retryable = exports.retry = exports.rejectSeries = exports.rejectLimit = exports.reject = exports.reflectAll = exports.reflect = exports.reduceRight = exports.reduce = exports.race = exports.queue = exports.priorityQueue = exports.parallelLimit = exports.parallel = exports.nextTick = exports.memoize = exports.mapValuesSeries = exports.mapValuesLimit = exports.mapValues = exports.mapSeries = exports.mapLimit = exports.map = exports.log = exports.groupBySeries = exports.groupByLimit = exports.groupBy = exports.forever = exports.filterSeries = exports.filterLimit = exports.filter = exports.everySeries = exports.everyLimit = exports.every = exports.ensureAsync = exports.eachSeries = exports.eachOfSeries = exports.eachOfLimit = exports.eachOf = exports.eachLimit = exports.each = exports.during = exports.doWhilst = exports.doUntil = exports.doDuring = exports.dir = exports.detectSeries = exports.detectLimit = exports.detect = exports.constant = exports.concatSeries = exports.concatLimit = exports.concat = exports.compose = exports.cargo = exports.autoInject = exports.auto = exports.asyncify = exports.applyEachSeries = exports.applyEach = exports.apply = undefined;
  6. var _apply = require('./apply');
  7. var _apply2 = _interopRequireDefault(_apply);
  8. var _applyEach = require('./applyEach');
  9. var _applyEach2 = _interopRequireDefault(_applyEach);
  10. var _applyEachSeries = require('./applyEachSeries');
  11. var _applyEachSeries2 = _interopRequireDefault(_applyEachSeries);
  12. var _asyncify = require('./asyncify');
  13. var _asyncify2 = _interopRequireDefault(_asyncify);
  14. var _auto = require('./auto');
  15. var _auto2 = _interopRequireDefault(_auto);
  16. var _autoInject = require('./autoInject');
  17. var _autoInject2 = _interopRequireDefault(_autoInject);
  18. var _cargo = require('./cargo');
  19. var _cargo2 = _interopRequireDefault(_cargo);
  20. var _compose = require('./compose');
  21. var _compose2 = _interopRequireDefault(_compose);
  22. var _concat = require('./concat');
  23. var _concat2 = _interopRequireDefault(_concat);
  24. var _concatLimit = require('./concatLimit');
  25. var _concatLimit2 = _interopRequireDefault(_concatLimit);
  26. var _concatSeries = require('./concatSeries');
  27. var _concatSeries2 = _interopRequireDefault(_concatSeries);
  28. var _constant = require('./constant');
  29. var _constant2 = _interopRequireDefault(_constant);
  30. var _detect = require('./detect');
  31. var _detect2 = _interopRequireDefault(_detect);
  32. var _detectLimit = require('./detectLimit');
  33. var _detectLimit2 = _interopRequireDefault(_detectLimit);
  34. var _detectSeries = require('./detectSeries');
  35. var _detectSeries2 = _interopRequireDefault(_detectSeries);
  36. var _dir = require('./dir');
  37. var _dir2 = _interopRequireDefault(_dir);
  38. var _doDuring = require('./doDuring');
  39. var _doDuring2 = _interopRequireDefault(_doDuring);
  40. var _doUntil = require('./doUntil');
  41. var _doUntil2 = _interopRequireDefault(_doUntil);
  42. var _doWhilst = require('./doWhilst');
  43. var _doWhilst2 = _interopRequireDefault(_doWhilst);
  44. var _during = require('./during');
  45. var _during2 = _interopRequireDefault(_during);
  46. var _each = require('./each');
  47. var _each2 = _interopRequireDefault(_each);
  48. var _eachLimit = require('./eachLimit');
  49. var _eachLimit2 = _interopRequireDefault(_eachLimit);
  50. var _eachOf = require('./eachOf');
  51. var _eachOf2 = _interopRequireDefault(_eachOf);
  52. var _eachOfLimit = require('./eachOfLimit');
  53. var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
  54. var _eachOfSeries = require('./eachOfSeries');
  55. var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
  56. var _eachSeries = require('./eachSeries');
  57. var _eachSeries2 = _interopRequireDefault(_eachSeries);
  58. var _ensureAsync = require('./ensureAsync');
  59. var _ensureAsync2 = _interopRequireDefault(_ensureAsync);
  60. var _every = require('./every');
  61. var _every2 = _interopRequireDefault(_every);
  62. var _everyLimit = require('./everyLimit');
  63. var _everyLimit2 = _interopRequireDefault(_everyLimit);
  64. var _everySeries = require('./everySeries');
  65. var _everySeries2 = _interopRequireDefault(_everySeries);
  66. var _filter = require('./filter');
  67. var _filter2 = _interopRequireDefault(_filter);
  68. var _filterLimit = require('./filterLimit');
  69. var _filterLimit2 = _interopRequireDefault(_filterLimit);
  70. var _filterSeries = require('./filterSeries');
  71. var _filterSeries2 = _interopRequireDefault(_filterSeries);
  72. var _forever = require('./forever');
  73. var _forever2 = _interopRequireDefault(_forever);
  74. var _groupBy = require('./groupBy');
  75. var _groupBy2 = _interopRequireDefault(_groupBy);
  76. var _groupByLimit = require('./groupByLimit');
  77. var _groupByLimit2 = _interopRequireDefault(_groupByLimit);
  78. var _groupBySeries = require('./groupBySeries');
  79. var _groupBySeries2 = _interopRequireDefault(_groupBySeries);
  80. var _log = require('./log');
  81. var _log2 = _interopRequireDefault(_log);
  82. var _map = require('./map');
  83. var _map2 = _interopRequireDefault(_map);
  84. var _mapLimit = require('./mapLimit');
  85. var _mapLimit2 = _interopRequireDefault(_mapLimit);
  86. var _mapSeries = require('./mapSeries');
  87. var _mapSeries2 = _interopRequireDefault(_mapSeries);
  88. var _mapValues = require('./mapValues');
  89. var _mapValues2 = _interopRequireDefault(_mapValues);
  90. var _mapValuesLimit = require('./mapValuesLimit');
  91. var _mapValuesLimit2 = _interopRequireDefault(_mapValuesLimit);
  92. var _mapValuesSeries = require('./mapValuesSeries');
  93. var _mapValuesSeries2 = _interopRequireDefault(_mapValuesSeries);
  94. var _memoize = require('./memoize');
  95. var _memoize2 = _interopRequireDefault(_memoize);
  96. var _nextTick = require('./nextTick');
  97. var _nextTick2 = _interopRequireDefault(_nextTick);
  98. var _parallel = require('./parallel');
  99. var _parallel2 = _interopRequireDefault(_parallel);
  100. var _parallelLimit = require('./parallelLimit');
  101. var _parallelLimit2 = _interopRequireDefault(_parallelLimit);
  102. var _priorityQueue = require('./priorityQueue');
  103. var _priorityQueue2 = _interopRequireDefault(_priorityQueue);
  104. var _queue = require('./queue');
  105. var _queue2 = _interopRequireDefault(_queue);
  106. var _race = require('./race');
  107. var _race2 = _interopRequireDefault(_race);
  108. var _reduce = require('./reduce');
  109. var _reduce2 = _interopRequireDefault(_reduce);
  110. var _reduceRight = require('./reduceRight');
  111. var _reduceRight2 = _interopRequireDefault(_reduceRight);
  112. var _reflect = require('./reflect');
  113. var _reflect2 = _interopRequireDefault(_reflect);
  114. var _reflectAll = require('./reflectAll');
  115. var _reflectAll2 = _interopRequireDefault(_reflectAll);
  116. var _reject = require('./reject');
  117. var _reject2 = _interopRequireDefault(_reject);
  118. var _rejectLimit = require('./rejectLimit');
  119. var _rejectLimit2 = _interopRequireDefault(_rejectLimit);
  120. var _rejectSeries = require('./rejectSeries');
  121. var _rejectSeries2 = _interopRequireDefault(_rejectSeries);
  122. var _retry = require('./retry');
  123. var _retry2 = _interopRequireDefault(_retry);
  124. var _retryable = require('./retryable');
  125. var _retryable2 = _interopRequireDefault(_retryable);
  126. var _seq = require('./seq');
  127. var _seq2 = _interopRequireDefault(_seq);
  128. var _series = require('./series');
  129. var _series2 = _interopRequireDefault(_series);
  130. var _setImmediate = require('./setImmediate');
  131. var _setImmediate2 = _interopRequireDefault(_setImmediate);
  132. var _some = require('./some');
  133. var _some2 = _interopRequireDefault(_some);
  134. var _someLimit = require('./someLimit');
  135. var _someLimit2 = _interopRequireDefault(_someLimit);
  136. var _someSeries = require('./someSeries');
  137. var _someSeries2 = _interopRequireDefault(_someSeries);
  138. var _sortBy = require('./sortBy');
  139. var _sortBy2 = _interopRequireDefault(_sortBy);
  140. var _timeout = require('./timeout');
  141. var _timeout2 = _interopRequireDefault(_timeout);
  142. var _times = require('./times');
  143. var _times2 = _interopRequireDefault(_times);
  144. var _timesLimit = require('./timesLimit');
  145. var _timesLimit2 = _interopRequireDefault(_timesLimit);
  146. var _timesSeries = require('./timesSeries');
  147. var _timesSeries2 = _interopRequireDefault(_timesSeries);
  148. var _transform = require('./transform');
  149. var _transform2 = _interopRequireDefault(_transform);
  150. var _tryEach = require('./tryEach');
  151. var _tryEach2 = _interopRequireDefault(_tryEach);
  152. var _unmemoize = require('./unmemoize');
  153. var _unmemoize2 = _interopRequireDefault(_unmemoize);
  154. var _until = require('./until');
  155. var _until2 = _interopRequireDefault(_until);
  156. var _waterfall = require('./waterfall');
  157. var _waterfall2 = _interopRequireDefault(_waterfall);
  158. var _whilst = require('./whilst');
  159. var _whilst2 = _interopRequireDefault(_whilst);
  160. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  161. exports.default = {
  162. apply: _apply2.default,
  163. applyEach: _applyEach2.default,
  164. applyEachSeries: _applyEachSeries2.default,
  165. asyncify: _asyncify2.default,
  166. auto: _auto2.default,
  167. autoInject: _autoInject2.default,
  168. cargo: _cargo2.default,
  169. compose: _compose2.default,
  170. concat: _concat2.default,
  171. concatLimit: _concatLimit2.default,
  172. concatSeries: _concatSeries2.default,
  173. constant: _constant2.default,
  174. detect: _detect2.default,
  175. detectLimit: _detectLimit2.default,
  176. detectSeries: _detectSeries2.default,
  177. dir: _dir2.default,
  178. doDuring: _doDuring2.default,
  179. doUntil: _doUntil2.default,
  180. doWhilst: _doWhilst2.default,
  181. during: _during2.default,
  182. each: _each2.default,
  183. eachLimit: _eachLimit2.default,
  184. eachOf: _eachOf2.default,
  185. eachOfLimit: _eachOfLimit2.default,
  186. eachOfSeries: _eachOfSeries2.default,
  187. eachSeries: _eachSeries2.default,
  188. ensureAsync: _ensureAsync2.default,
  189. every: _every2.default,
  190. everyLimit: _everyLimit2.default,
  191. everySeries: _everySeries2.default,
  192. filter: _filter2.default,
  193. filterLimit: _filterLimit2.default,
  194. filterSeries: _filterSeries2.default,
  195. forever: _forever2.default,
  196. groupBy: _groupBy2.default,
  197. groupByLimit: _groupByLimit2.default,
  198. groupBySeries: _groupBySeries2.default,
  199. log: _log2.default,
  200. map: _map2.default,
  201. mapLimit: _mapLimit2.default,
  202. mapSeries: _mapSeries2.default,
  203. mapValues: _mapValues2.default,
  204. mapValuesLimit: _mapValuesLimit2.default,
  205. mapValuesSeries: _mapValuesSeries2.default,
  206. memoize: _memoize2.default,
  207. nextTick: _nextTick2.default,
  208. parallel: _parallel2.default,
  209. parallelLimit: _parallelLimit2.default,
  210. priorityQueue: _priorityQueue2.default,
  211. queue: _queue2.default,
  212. race: _race2.default,
  213. reduce: _reduce2.default,
  214. reduceRight: _reduceRight2.default,
  215. reflect: _reflect2.default,
  216. reflectAll: _reflectAll2.default,
  217. reject: _reject2.default,
  218. rejectLimit: _rejectLimit2.default,
  219. rejectSeries: _rejectSeries2.default,
  220. retry: _retry2.default,
  221. retryable: _retryable2.default,
  222. seq: _seq2.default,
  223. series: _series2.default,
  224. setImmediate: _setImmediate2.default,
  225. some: _some2.default,
  226. someLimit: _someLimit2.default,
  227. someSeries: _someSeries2.default,
  228. sortBy: _sortBy2.default,
  229. timeout: _timeout2.default,
  230. times: _times2.default,
  231. timesLimit: _timesLimit2.default,
  232. timesSeries: _timesSeries2.default,
  233. transform: _transform2.default,
  234. tryEach: _tryEach2.default,
  235. unmemoize: _unmemoize2.default,
  236. until: _until2.default,
  237. waterfall: _waterfall2.default,
  238. whilst: _whilst2.default,
  239. // aliases
  240. all: _every2.default,
  241. allLimit: _everyLimit2.default,
  242. allSeries: _everySeries2.default,
  243. any: _some2.default,
  244. anyLimit: _someLimit2.default,
  245. anySeries: _someSeries2.default,
  246. find: _detect2.default,
  247. findLimit: _detectLimit2.default,
  248. findSeries: _detectSeries2.default,
  249. forEach: _each2.default,
  250. forEachSeries: _eachSeries2.default,
  251. forEachLimit: _eachLimit2.default,
  252. forEachOf: _eachOf2.default,
  253. forEachOfSeries: _eachOfSeries2.default,
  254. forEachOfLimit: _eachOfLimit2.default,
  255. inject: _reduce2.default,
  256. foldl: _reduce2.default,
  257. foldr: _reduceRight2.default,
  258. select: _filter2.default,
  259. selectLimit: _filterLimit2.default,
  260. selectSeries: _filterSeries2.default,
  261. wrapSync: _asyncify2.default
  262. }; /**
  263. * An "async function" in the context of Async is an asynchronous function with
  264. * a variable number of parameters, with the final parameter being a callback.
  265. * (`function (arg1, arg2, ..., callback) {}`)
  266. * The final callback is of the form `callback(err, results...)`, which must be
  267. * called once the function is completed. The callback should be called with a
  268. * Error as its first argument to signal that an error occurred.
  269. * Otherwise, if no error occurred, it should be called with `null` as the first
  270. * argument, and any additional `result` arguments that may apply, to signal
  271. * successful completion.
  272. * The callback must be called exactly once, ideally on a later tick of the
  273. * JavaScript event loop.
  274. *
  275. * This type of function is also referred to as a "Node-style async function",
  276. * or a "continuation passing-style function" (CPS). Most of the methods of this
  277. * library are themselves CPS/Node-style async functions, or functions that
  278. * return CPS/Node-style async functions.
  279. *
  280. * Wherever we accept a Node-style async function, we also directly accept an
  281. * [ES2017 `async` function]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function}.
  282. * In this case, the `async` function will not be passed a final callback
  283. * argument, and any thrown error will be used as the `err` argument of the
  284. * implicit callback, and the return value will be used as the `result` value.
  285. * (i.e. a `rejected` of the returned Promise becomes the `err` callback
  286. * argument, and a `resolved` value becomes the `result`.)
  287. *
  288. * Note, due to JavaScript limitations, we can only detect native `async`
  289. * functions and not transpilied implementations.
  290. * Your environment must have `async`/`await` support for this to work.
  291. * (e.g. Node > v7.6, or a recent version of a modern browser).
  292. * If you are using `async` functions through a transpiler (e.g. Babel), you
  293. * must still wrap the function with [asyncify]{@link module:Utils.asyncify},
  294. * because the `async function` will be compiled to an ordinary function that
  295. * returns a promise.
  296. *
  297. * @typedef {Function} AsyncFunction
  298. * @static
  299. */
  300. /**
  301. * Async is a utility module which provides straight-forward, powerful functions
  302. * for working with asynchronous JavaScript. Although originally designed for
  303. * use with [Node.js](http://nodejs.org) and installable via
  304. * `npm install --save async`, it can also be used directly in the browser.
  305. * @module async
  306. * @see AsyncFunction
  307. */
  308. /**
  309. * A collection of `async` functions for manipulating collections, such as
  310. * arrays and objects.
  311. * @module Collections
  312. */
  313. /**
  314. * A collection of `async` functions for controlling the flow through a script.
  315. * @module ControlFlow
  316. */
  317. /**
  318. * A collection of `async` utility functions.
  319. * @module Utils
  320. */
  321. exports.apply = _apply2.default;
  322. exports.applyEach = _applyEach2.default;
  323. exports.applyEachSeries = _applyEachSeries2.default;
  324. exports.asyncify = _asyncify2.default;
  325. exports.auto = _auto2.default;
  326. exports.autoInject = _autoInject2.default;
  327. exports.cargo = _cargo2.default;
  328. exports.compose = _compose2.default;
  329. exports.concat = _concat2.default;
  330. exports.concatLimit = _concatLimit2.default;
  331. exports.concatSeries = _concatSeries2.default;
  332. exports.constant = _constant2.default;
  333. exports.detect = _detect2.default;
  334. exports.detectLimit = _detectLimit2.default;
  335. exports.detectSeries = _detectSeries2.default;
  336. exports.dir = _dir2.default;
  337. exports.doDuring = _doDuring2.default;
  338. exports.doUntil = _doUntil2.default;
  339. exports.doWhilst = _doWhilst2.default;
  340. exports.during = _during2.default;
  341. exports.each = _each2.default;
  342. exports.eachLimit = _eachLimit2.default;
  343. exports.eachOf = _eachOf2.default;
  344. exports.eachOfLimit = _eachOfLimit2.default;
  345. exports.eachOfSeries = _eachOfSeries2.default;
  346. exports.eachSeries = _eachSeries2.default;
  347. exports.ensureAsync = _ensureAsync2.default;
  348. exports.every = _every2.default;
  349. exports.everyLimit = _everyLimit2.default;
  350. exports.everySeries = _everySeries2.default;
  351. exports.filter = _filter2.default;
  352. exports.filterLimit = _filterLimit2.default;
  353. exports.filterSeries = _filterSeries2.default;
  354. exports.forever = _forever2.default;
  355. exports.groupBy = _groupBy2.default;
  356. exports.groupByLimit = _groupByLimit2.default;
  357. exports.groupBySeries = _groupBySeries2.default;
  358. exports.log = _log2.default;
  359. exports.map = _map2.default;
  360. exports.mapLimit = _mapLimit2.default;
  361. exports.mapSeries = _mapSeries2.default;
  362. exports.mapValues = _mapValues2.default;
  363. exports.mapValuesLimit = _mapValuesLimit2.default;
  364. exports.mapValuesSeries = _mapValuesSeries2.default;
  365. exports.memoize = _memoize2.default;
  366. exports.nextTick = _nextTick2.default;
  367. exports.parallel = _parallel2.default;
  368. exports.parallelLimit = _parallelLimit2.default;
  369. exports.priorityQueue = _priorityQueue2.default;
  370. exports.queue = _queue2.default;
  371. exports.race = _race2.default;
  372. exports.reduce = _reduce2.default;
  373. exports.reduceRight = _reduceRight2.default;
  374. exports.reflect = _reflect2.default;
  375. exports.reflectAll = _reflectAll2.default;
  376. exports.reject = _reject2.default;
  377. exports.rejectLimit = _rejectLimit2.default;
  378. exports.rejectSeries = _rejectSeries2.default;
  379. exports.retry = _retry2.default;
  380. exports.retryable = _retryable2.default;
  381. exports.seq = _seq2.default;
  382. exports.series = _series2.default;
  383. exports.setImmediate = _setImmediate2.default;
  384. exports.some = _some2.default;
  385. exports.someLimit = _someLimit2.default;
  386. exports.someSeries = _someSeries2.default;
  387. exports.sortBy = _sortBy2.default;
  388. exports.timeout = _timeout2.default;
  389. exports.times = _times2.default;
  390. exports.timesLimit = _timesLimit2.default;
  391. exports.timesSeries = _timesSeries2.default;
  392. exports.transform = _transform2.default;
  393. exports.tryEach = _tryEach2.default;
  394. exports.unmemoize = _unmemoize2.default;
  395. exports.until = _until2.default;
  396. exports.waterfall = _waterfall2.default;
  397. exports.whilst = _whilst2.default;
  398. exports.all = _every2.default;
  399. exports.allLimit = _everyLimit2.default;
  400. exports.allSeries = _everySeries2.default;
  401. exports.any = _some2.default;
  402. exports.anyLimit = _someLimit2.default;
  403. exports.anySeries = _someSeries2.default;
  404. exports.find = _detect2.default;
  405. exports.findLimit = _detectLimit2.default;
  406. exports.findSeries = _detectSeries2.default;
  407. exports.forEach = _each2.default;
  408. exports.forEachSeries = _eachSeries2.default;
  409. exports.forEachLimit = _eachLimit2.default;
  410. exports.forEachOf = _eachOf2.default;
  411. exports.forEachOfSeries = _eachOfSeries2.default;
  412. exports.forEachOfLimit = _eachOfLimit2.default;
  413. exports.inject = _reduce2.default;
  414. exports.foldl = _reduce2.default;
  415. exports.foldr = _reduceRight2.default;
  416. exports.select = _filter2.default;
  417. exports.selectLimit = _filterLimit2.default;
  418. exports.selectSeries = _filterSeries2.default;
  419. exports.wrapSync = _asyncify2.default;