diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-24 15:10:37 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-24 15:11:17 +0200 |
commit | 7a3df06eb573d36142bd1a8e03c5ce8752d300b3 (patch) | |
tree | 70bfaea8884c374876f607774850a3a51c0cb381 /node_modules/async | |
parent | aca1143cb9eed16cf37f04e475e4257418dd18ac (diff) |
fix build issues and add typedoc
Diffstat (limited to 'node_modules/async')
31 files changed, 1022 insertions, 813 deletions
diff --git a/node_modules/async/CHANGELOG.md b/node_modules/async/CHANGELOG.md index e5bfa24d5..6ff975fa9 100644 --- a/node_modules/async/CHANGELOG.md +++ b/node_modules/async/CHANGELOG.md @@ -1,15 +1,24 @@ +# v2.4.0 +- Added `tryEach`, for running async functions in parallel, where you only expect one to succeed. (#1365, #687) +- Improved performance, most notably in `parallel` and `waterfall` (#1395) +- Added `queue.remove()`, for removing items in a `queue` (#1397, #1391) +- Fixed using `eval`, preventing Async from running in pages with Content Security Policy (#1404, #1403) +- Fixed errors thrown in an `asyncify`ed function's callback being caught by the underlying Promise (#1408) +- Fixed timing of `queue.empty()` (#1367) +- Various doc fixes (#1314, #1394, #1412) + # v2.3.0 -- Added support for ES2017 `async` functions. Wherever you can pass a Node-style/CPS function that uses a callback, you can also pass an `async` function. Previously, you had to wrap `async` functions with `asyncify`. The caveat is that it will onyl work if `async` functions are supported nateively in your environment, transpilied implementations can't be detected. (#1386, #1390) -- Small doc fix (#1392) +- Added support for ES2017 `async` functions. Wherever you can pass a Node-style/CPS function that uses a callback, you can also pass an `async` function. Previously, you had to wrap `async` functions with `asyncify`. The caveat is that it will only work if `async` functions are supported natively in your environment, transpiled implementations can't be detected. ([#1386](https://github.com/caolan/async/issues/1386), [#1390](https://github.com/caolan/async/issues/1390)) +- Small doc fix ([#1392](https://github.com/caolan/async/issues/1392)) # v2.2.0 -- Added `groupBy`, and the `Series`/`Limit` equivalents, analogous to [`_.groupBy`](http://lodash.com/docs#groupBy) (#1364) -- Fixed `transform` bug when `callback` was not passed (#1381) -- Added note about `reflect` to `parallel` docs (#1385) +- Added `groupBy`, and the `Series`/`Limit` equivalents, analogous to [`_.groupBy`](http://lodash.com/docs#groupBy) ([#1364](https://github.com/caolan/async/issues/1364)) +- Fixed `transform` bug when `callback` was not passed ([#1381](https://github.com/caolan/async/issues/1381)) +- Added note about `reflect` to `parallel` docs ([#1385](https://github.com/caolan/async/issues/1385)) # v2.1.5 -- Fix `auto` bug when function names collided with Array.prototype (#1358) -- Improve some error messages (#1349) +- Fix `auto` bug when function names collided with Array.prototype ([#1358](https://github.com/caolan/async/issues/1358)) +- Improve some error messages ([#1349](https://github.com/caolan/async/issues/1349)) - Avoid stack overflow case in queue - Fixed an issue in `some`, `every` and `find` where processing would continue after the result was determined. - Cleanup implementations of `some`, `every` and `find` @@ -19,19 +28,19 @@ - Create optimized hotpath for `filter` in array case. # v2.1.2 -- Fixed a stackoverflow bug with `detect`, `some`, `every` on large inputs (#1293). +- Fixed a stackoverflow bug with `detect`, `some`, `every` on large inputs ([#1293](https://github.com/caolan/async/issues/1293)). # v2.1.0 -- `retry` and `retryable` now support an optional `errorFilter` function that determines if the `task` should retry on the error (#1256, #1261) -- Optimized array iteration in `race`, `cargo`, `queue`, and `priorityQueue` (#1253) -- Added alias documentation to doc site (#1251, #1254) -- Added [BootStrap scrollspy](http://getbootstrap.com/javascript/#scrollspy) to docs to highlight in the sidebar the current method being viewed (#1289, #1300) -- Various minor doc fixes (#1263, #1264, #1271, #1278, #1280, #1282, #1302) +- `retry` and `retryable` now support an optional `errorFilter` function that determines if the `task` should retry on the error ([#1256](https://github.com/caolan/async/issues/1256), [#1261](https://github.com/caolan/async/issues/1261)) +- Optimized array iteration in `race`, `cargo`, `queue`, and `priorityQueue` ([#1253](https://github.com/caolan/async/issues/1253)) +- Added alias documentation to doc site ([#1251](https://github.com/caolan/async/issues/1251), [#1254](https://github.com/caolan/async/issues/1254)) +- Added [BootStrap scrollspy](http://getbootstrap.com/javascript/#scrollspy) to docs to highlight in the sidebar the current method being viewed ([#1289](https://github.com/caolan/async/issues/1289), [#1300](https://github.com/caolan/async/issues/1300)) +- Various minor doc fixes ([#1263](https://github.com/caolan/async/issues/1263), [#1264](https://github.com/caolan/async/issues/1264), [#1271](https://github.com/caolan/async/issues/1271), [#1278](https://github.com/caolan/async/issues/1278), [#1280](https://github.com/caolan/async/issues/1280), [#1282](https://github.com/caolan/async/issues/1282), [#1302](https://github.com/caolan/async/issues/1302)) # v2.0.1 -- Significantly optimized all iteration based collection methods such as `each`, `map`, `filter`, etc (#1245, #1246, #1247). +- Significantly optimized all iteration based collection methods such as `each`, `map`, `filter`, etc ([#1245](https://github.com/caolan/async/issues/1245), [#1246](https://github.com/caolan/async/issues/1246), [#1247](https://github.com/caolan/async/issues/1247)). # v2.0.0 @@ -62,96 +71,96 @@ Another big performance win has been re-implementing `queue`, `cargo`, and `prio ## New Features -- Async is now modularized. Individual functions can be `require()`d from the main package. (`require('async/auto')`) (#984, #996) -- Async is also available as a collection of ES2015 modules in the new `async-es` package. (`import {forEachSeries} from 'async-es'`) (#984, #996) -- Added `race`, analogous to `Promise.race()`. It will run an array of async tasks in parallel and will call its callback with the result of the first task to respond. (#568, #1038) -- Collection methods now accept ES2015 iterators. Maps, Sets, and anything that implements the iterator spec can now be passed directly to `each`, `map`, `parallel`, etc.. (#579, #839, #1074) -- Added `mapValues`, for mapping over the properties of an object and returning an object with the same keys. (#1157, #1177) -- Added `timeout`, a wrapper for an async function that will make the task time-out after the specified time. (#1007, #1027) -- Added `reflect` and `reflectAll`, analagous to [`Promise.reflect()`](http://bluebirdjs.com/docs/api/reflect.html), a wrapper for async tasks that always succeeds, by gathering results and errors into an object. (#942, #1012, #1095) -- `constant` supports dynamic arguments -- it will now always use its last argument as the callback. (#1016, #1052) -- `setImmediate` and `nextTick` now support arguments to partially apply to the deferred function, like the node-native versions do. (#940, #1053) -- `auto` now supports resolving cyclic dependencies using [Kahn's algorithm](https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm) (#1140). -- Added `autoInject`, a relative of `auto` that automatically spreads a task's dependencies as arguments to the task function. (#608, #1055, #1099, #1100) -- You can now limit the concurrency of `auto` tasks. (#635, #637) -- Added `retryable`, a relative of `retry` that wraps an async function, making it retry when called. (#1058) -- `retry` now supports specifying a function that determines the next time interval, useful for exponential backoff, logging and other retry strategies. (#1161) -- `retry` will now pass all of the arguments the task function was resolved with to the callback (#1231). -- Added `q.unsaturated` -- callback called when a `queue`'s number of running workers falls below a threshold. (#868, #1030, #1033, #1034) -- Added `q.error` -- a callback called whenever a `queue` task calls its callback with an error. (#1170) -- `applyEach` and `applyEachSeries` now pass results to the final callback. (#1088) +- Async is now modularized. Individual functions can be `require()`d from the main package. (`require('async/auto')`) ([#984](https://github.com/caolan/async/issues/984), [#996](https://github.com/caolan/async/issues/996)) +- Async is also available as a collection of ES2015 modules in the new `async-es` package. (`import {forEachSeries} from 'async-es'`) ([#984](https://github.com/caolan/async/issues/984), [#996](https://github.com/caolan/async/issues/996)) +- Added `race`, analogous to `Promise.race()`. It will run an array of async tasks in parallel and will call its callback with the result of the first task to respond. ([#568](https://github.com/caolan/async/issues/568), [#1038](https://github.com/caolan/async/issues/1038)) +- Collection methods now accept ES2015 iterators. Maps, Sets, and anything that implements the iterator spec can now be passed directly to `each`, `map`, `parallel`, etc.. ([#579](https://github.com/caolan/async/issues/579), [#839](https://github.com/caolan/async/issues/839), [#1074](https://github.com/caolan/async/issues/1074)) +- Added `mapValues`, for mapping over the properties of an object and returning an object with the same keys. ([#1157](https://github.com/caolan/async/issues/1157), [#1177](https://github.com/caolan/async/issues/1177)) +- Added `timeout`, a wrapper for an async function that will make the task time-out after the specified time. ([#1007](https://github.com/caolan/async/issues/1007), [#1027](https://github.com/caolan/async/issues/1027)) +- Added `reflect` and `reflectAll`, analagous to [`Promise.reflect()`](http://bluebirdjs.com/docs/api/reflect.html), a wrapper for async tasks that always succeeds, by gathering results and errors into an object. ([#942](https://github.com/caolan/async/issues/942), [#1012](https://github.com/caolan/async/issues/1012), [#1095](https://github.com/caolan/async/issues/1095)) +- `constant` supports dynamic arguments -- it will now always use its last argument as the callback. ([#1016](https://github.com/caolan/async/issues/1016), [#1052](https://github.com/caolan/async/issues/1052)) +- `setImmediate` and `nextTick` now support arguments to partially apply to the deferred function, like the node-native versions do. ([#940](https://github.com/caolan/async/issues/940), [#1053](https://github.com/caolan/async/issues/1053)) +- `auto` now supports resolving cyclic dependencies using [Kahn's algorithm](https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm) ([#1140](https://github.com/caolan/async/issues/1140)). +- Added `autoInject`, a relative of `auto` that automatically spreads a task's dependencies as arguments to the task function. ([#608](https://github.com/caolan/async/issues/608), [#1055](https://github.com/caolan/async/issues/1055), [#1099](https://github.com/caolan/async/issues/1099), [#1100](https://github.com/caolan/async/issues/1100)) +- You can now limit the concurrency of `auto` tasks. ([#635](https://github.com/caolan/async/issues/635), [#637](https://github.com/caolan/async/issues/637)) +- Added `retryable`, a relative of `retry` that wraps an async function, making it retry when called. ([#1058](https://github.com/caolan/async/issues/1058)) +- `retry` now supports specifying a function that determines the next time interval, useful for exponential backoff, logging and other retry strategies. ([#1161](https://github.com/caolan/async/issues/1161)) +- `retry` will now pass all of the arguments the task function was resolved with to the callback ([#1231](https://github.com/caolan/async/issues/1231)). +- Added `q.unsaturated` -- callback called when a `queue`'s number of running workers falls below a threshold. ([#868](https://github.com/caolan/async/issues/868), [#1030](https://github.com/caolan/async/issues/1030), [#1033](https://github.com/caolan/async/issues/1033), [#1034](https://github.com/caolan/async/issues/1034)) +- Added `q.error` -- a callback called whenever a `queue` task calls its callback with an error. ([#1170](https://github.com/caolan/async/issues/1170)) +- `applyEach` and `applyEachSeries` now pass results to the final callback. ([#1088](https://github.com/caolan/async/issues/1088)) ## Breaking changes -- Calling a callback more than once is considered an error, and an error will be thrown. This had an explicit breaking change in `waterfall`. If you were relying on this behavior, you should more accurately represent your control flow as an event emitter or stream. (#814, #815, #1048, #1050) -- `auto` task functions now always take the callback as the last argument. If a task has dependencies, the `results` object will be passed as the first argument. To migrate old task functions, wrap them with [`_.flip`](https://lodash.com/docs#flip) (#1036, #1042) -- Internal `setImmediate` calls have been refactored away. This may make existing flows vulnerable to stack overflows if you use many synchronous functions in series. Use `ensureAsync` to work around this. (#696, #704, #1049, #1050) -- `map` used to return an object when iterating over an object. `map` now always returns an array, like in other libraries. The previous object behavior has been split out into `mapValues`. (#1157, #1177) -- `filter`, `reject`, `some`, `every`, and related functions now expect an error as the first callback argument, rather than just a simple boolean. Pass `null` as the first argument, or use `fs.access` instead of `fs.exists`. (#118, #774, #1028, #1041) -- `{METHOD}` and `{METHOD}Series` are now implemented in terms of `{METHOD}Limit`. This is a major internal simplification, and is not expected to cause many problems, but it does subtly affect how functions execute internally. (#778, #847) -- `retry`'s callback is now optional. Previously, omitting the callback would partially apply the function, meaning it could be passed directly as a task to `series` or `auto`. The partially applied "control-flow" behavior has been separated out into `retryable`. (#1054, #1058) -- The test function for `whilst`, `until`, and `during` used to be passed non-error args from the iteratee function's callback, but this led to weirdness where the first call of the test function would be passed no args. We have made it so the test function is never passed extra arguments, and only the `doWhilst`, `doUntil`, and `doDuring` functions pass iteratee callback arguments to the test function (#1217, #1224) -- The `q.tasks` array has been renamed `q._tasks` and is now implemented as a doubly linked list (DLL). Any code that used to interact with this array will need to be updated to either use the provided helpers or support DLLs (#1205). -- The timing of the `q.saturated()` callback in a `queue` has been modified to better reflect when tasks pushed to the queue will start queueing. (#724, #1078) -- Removed `iterator` method in favour of [ES2015 iterator protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators ) which natively supports arrays (#1237) -- Dropped support for Component, Jam, SPM, and Volo (#1175, ##176) +- Calling a callback more than once is considered an error, and an error will be thrown. This had an explicit breaking change in `waterfall`. If you were relying on this behavior, you should more accurately represent your control flow as an event emitter or stream. ([#814](https://github.com/caolan/async/issues/814), [#815](https://github.com/caolan/async/issues/815), [#1048](https://github.com/caolan/async/issues/1048), [#1050](https://github.com/caolan/async/issues/1050)) +- `auto` task functions now always take the callback as the last argument. If a task has dependencies, the `results` object will be passed as the first argument. To migrate old task functions, wrap them with [`_.flip`](https://lodash.com/docs#flip) ([#1036](https://github.com/caolan/async/issues/1036), [#1042](https://github.com/caolan/async/issues/1042)) +- Internal `setImmediate` calls have been refactored away. This may make existing flows vulnerable to stack overflows if you use many synchronous functions in series. Use `ensureAsync` to work around this. ([#696](https://github.com/caolan/async/issues/696), [#704](https://github.com/caolan/async/issues/704), [#1049](https://github.com/caolan/async/issues/1049), [#1050](https://github.com/caolan/async/issues/1050)) +- `map` used to return an object when iterating over an object. `map` now always returns an array, like in other libraries. The previous object behavior has been split out into `mapValues`. ([#1157](https://github.com/caolan/async/issues/1157), [#1177](https://github.com/caolan/async/issues/1177)) +- `filter`, `reject`, `some`, `every`, and related functions now expect an error as the first callback argument, rather than just a simple boolean. Pass `null` as the first argument, or use `fs.access` instead of `fs.exists`. ([#118](https://github.com/caolan/async/issues/118), [#774](https://github.com/caolan/async/issues/774), [#1028](https://github.com/caolan/async/issues/1028), [#1041](https://github.com/caolan/async/issues/1041)) +- `{METHOD}` and `{METHOD}Series` are now implemented in terms of `{METHOD}Limit`. This is a major internal simplification, and is not expected to cause many problems, but it does subtly affect how functions execute internally. ([#778](https://github.com/caolan/async/issues/778), [#847](https://github.com/caolan/async/issues/847)) +- `retry`'s callback is now optional. Previously, omitting the callback would partially apply the function, meaning it could be passed directly as a task to `series` or `auto`. The partially applied "control-flow" behavior has been separated out into `retryable`. ([#1054](https://github.com/caolan/async/issues/1054), [#1058](https://github.com/caolan/async/issues/1058)) +- The test function for `whilst`, `until`, and `during` used to be passed non-error args from the iteratee function's callback, but this led to weirdness where the first call of the test function would be passed no args. We have made it so the test function is never passed extra arguments, and only the `doWhilst`, `doUntil`, and `doDuring` functions pass iteratee callback arguments to the test function ([#1217](https://github.com/caolan/async/issues/1217), [#1224](https://github.com/caolan/async/issues/1224)) +- The `q.tasks` array has been renamed `q._tasks` and is now implemented as a doubly linked list (DLL). Any code that used to interact with this array will need to be updated to either use the provided helpers or support DLLs ([#1205](https://github.com/caolan/async/issues/1205)). +- The timing of the `q.saturated()` callback in a `queue` has been modified to better reflect when tasks pushed to the queue will start queueing. ([#724](https://github.com/caolan/async/issues/724), [#1078](https://github.com/caolan/async/issues/1078)) +- Removed `iterator` method in favour of [ES2015 iterator protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators ) which natively supports arrays ([#1237](https://github.com/caolan/async/issues/1237)) +- Dropped support for Component, Jam, SPM, and Volo ([#1175](https://github.com/caolan/async/issues/1175), #[#176](https://github.com/caolan/async/issues/176)) ## Bug Fixes -- Improved handling of no dependency cases in `auto` & `autoInject` (#1147). -- Fixed a bug where the callback generated by `asyncify` with `Promises` could resolve twice (#1197). -- Fixed several documented optional callbacks not actually being optional (#1223). +- Improved handling of no dependency cases in `auto` & `autoInject` ([#1147](https://github.com/caolan/async/issues/1147)). +- Fixed a bug where the callback generated by `asyncify` with `Promises` could resolve twice ([#1197](https://github.com/caolan/async/issues/1197)). +- Fixed several documented optional callbacks not actually being optional ([#1223](https://github.com/caolan/async/issues/1223)). ## Other - Added `someSeries` and `everySeries` for symmetry, as well as a complete set of `any`/`anyLimit`/`anySeries` and `all`/`/allLmit`/`allSeries` aliases. - Added `find` as an alias for `detect. (as well as `findLimit` and `findSeries`). -- Various doc fixes (#1005, #1008, #1010, #1015, #1021, #1037, #1039, #1051, #1102, #1107, #1121, #1123, #1129, #1135, #1138, #1141, #1153, #1216, #1217, #1232, #1233, #1236, #1238) +- Various doc fixes ([#1005](https://github.com/caolan/async/issues/1005), [#1008](https://github.com/caolan/async/issues/1008), [#1010](https://github.com/caolan/async/issues/1010), [#1015](https://github.com/caolan/async/issues/1015), [#1021](https://github.com/caolan/async/issues/1021), [#1037](https://github.com/caolan/async/issues/1037), [#1039](https://github.com/caolan/async/issues/1039), [#1051](https://github.com/caolan/async/issues/1051), [#1102](https://github.com/caolan/async/issues/1102), [#1107](https://github.com/caolan/async/issues/1107), [#1121](https://github.com/caolan/async/issues/1121), [#1123](https://github.com/caolan/async/issues/1123), [#1129](https://github.com/caolan/async/issues/1129), [#1135](https://github.com/caolan/async/issues/1135), [#1138](https://github.com/caolan/async/issues/1138), [#1141](https://github.com/caolan/async/issues/1141), [#1153](https://github.com/caolan/async/issues/1153), [#1216](https://github.com/caolan/async/issues/1216), [#1217](https://github.com/caolan/async/issues/1217), [#1232](https://github.com/caolan/async/issues/1232), [#1233](https://github.com/caolan/async/issues/1233), [#1236](https://github.com/caolan/async/issues/1236), [#1238](https://github.com/caolan/async/issues/1238)) Thank you [**@aearly**](github.com/aearly) and [**@megawac**](github.com/megawac) for taking the lead on version 2 of async. ------------------------------------------ # v1.5.2 -- Allow using `"constructor"` as an argument in `memoize` (#998) -- Give a better error messsage when `auto` dependency checking fails (#994) -- Various doc updates (#936, #956, #979, #1002) +- Allow using `"constructor"` as an argument in `memoize` ([#998](https://github.com/caolan/async/issues/998)) +- Give a better error messsage when `auto` dependency checking fails ([#994](https://github.com/caolan/async/issues/994)) +- Various doc updates ([#936](https://github.com/caolan/async/issues/936), [#956](https://github.com/caolan/async/issues/956), [#979](https://github.com/caolan/async/issues/979), [#1002](https://github.com/caolan/async/issues/1002)) # v1.5.1 -- Fix issue with `pause` in `queue` with concurrency enabled (#946) -- `while` and `until` now pass the final result to callback (#963) -- `auto` will properly handle concurrency when there is no callback (#966) -- `auto` will no. properly stop execution when an error occurs (#988, #993) -- Various doc fixes (#971, #980) +- Fix issue with `pause` in `queue` with concurrency enabled ([#946](https://github.com/caolan/async/issues/946)) +- `while` and `until` now pass the final result to callback ([#963](https://github.com/caolan/async/issues/963)) +- `auto` will properly handle concurrency when there is no callback ([#966](https://github.com/caolan/async/issues/966)) +- `auto` will no. properly stop execution when an error occurs ([#988](https://github.com/caolan/async/issues/988), [#993](https://github.com/caolan/async/issues/993)) +- Various doc fixes ([#971](https://github.com/caolan/async/issues/971), [#980](https://github.com/caolan/async/issues/980)) # v1.5.0 -- Added `transform`, analogous to [`_.transform`](http://lodash.com/docs#transform) (#892) -- `map` now returns an object when an object is passed in, rather than array with non-numeric keys. `map` will begin always returning an array with numeric indexes in the next major release. (#873) -- `auto` now accepts an optional `concurrency` argument to limit the number o. running tasks (#637) -- Added `queue#workersList()`, to retrieve the lis. of currently running tasks. (#891) -- Various code simplifications (#896, #904) -- Various doc fixes :scroll: (#890, #894, #903, #905, #912) +- Added `transform`, analogous to [`_.transform`](http://lodash.com/docs#transform) ([#892](https://github.com/caolan/async/issues/892)) +- `map` now returns an object when an object is passed in, rather than array with non-numeric keys. `map` will begin always returning an array with numeric indexes in the next major release. ([#873](https://github.com/caolan/async/issues/873)) +- `auto` now accepts an optional `concurrency` argument to limit the number o. running tasks ([#637](https://github.com/caolan/async/issues/637)) +- Added `queue#workersList()`, to retrieve the lis. of currently running tasks. ([#891](https://github.com/caolan/async/issues/891)) +- Various code simplifications ([#896](https://github.com/caolan/async/issues/896), [#904](https://github.com/caolan/async/issues/904)) +- Various doc fixes :scroll: ([#890](https://github.com/caolan/async/issues/890), [#894](https://github.com/caolan/async/issues/894), [#903](https://github.com/caolan/async/issues/903), [#905](https://github.com/caolan/async/issues/905), [#912](https://github.com/caolan/async/issues/912)) # v1.4.2 -- Ensure coverage files don't get published on npm (#879) +- Ensure coverage files don't get published on npm ([#879](https://github.com/caolan/async/issues/879)) # v1.4.1 -- Add in overlooked `detectLimit` method (#866) -- Removed unnecessary files from npm releases (#861) -- Removed usage of a reserved word to prevent :boom: in older environments (#870) +- Add in overlooked `detectLimit` method ([#866](https://github.com/caolan/async/issues/866)) +- Removed unnecessary files from npm releases ([#861](https://github.com/caolan/async/issues/861)) +- Removed usage of a reserved word to prevent :boom: in older environments ([#870](https://github.com/caolan/async/issues/870)) # v1.4.0 -- `asyncify` now supports promises (#840) -- Added `Limit` versions of `filter` and `reject` (#836) -- Add `Limit` versions of `detect`, `some` and `every` (#828, #829) -- `some`, `every` and `detect` now short circuit early (#828, #829) -- Improve detection of the global object (#804), enabling use in WebWorkers -- `whilst` now called with arguments from iterator (#823) -- `during` now gets called with arguments from iterator (#824) +- `asyncify` now supports promises ([#840](https://github.com/caolan/async/issues/840)) +- Added `Limit` versions of `filter` and `reject` ([#836](https://github.com/caolan/async/issues/836)) +- Add `Limit` versions of `detect`, `some` and `every` ([#828](https://github.com/caolan/async/issues/828), [#829](https://github.com/caolan/async/issues/829)) +- `some`, `every` and `detect` now short circuit early ([#828](https://github.com/caolan/async/issues/828), [#829](https://github.com/caolan/async/issues/829)) +- Improve detection of the global object ([#804](https://github.com/caolan/async/issues/804)), enabling use in WebWorkers +- `whilst` now called with arguments from iterator ([#823](https://github.com/caolan/async/issues/823)) +- `during` now gets called with arguments from iterator ([#824](https://github.com/caolan/async/issues/824)) - Code simplifications and optimizations aplenty ([diff](https://github.com/caolan/async/compare/v1.3.0...v1.4.0)) @@ -159,42 +168,42 @@ Thank you [**@aearly**](github.com/aearly) and [**@megawac**](github.com/megawac New Features: - Added `constant` -- Added `asyncify`/`wrapSync` for making sync functions work with callbacks. (#671, #806) -- Added `during` and `doDuring`, which are like `whilst` with an async truth test. (#800) -- `retry` now accepts an `interval` parameter to specify a delay between retries. (#793) -- `async` should work better in Web Workers due to better `root` detection (#804) -- Callbacks are now optional in `whilst`, `doWhilst`, `until`, and `doUntil` (#642) -- Various internal updates (#786, #801, #802, #803) -- Various doc fixes (#790, #794) +- Added `asyncify`/`wrapSync` for making sync functions work with callbacks. ([#671](https://github.com/caolan/async/issues/671), [#806](https://github.com/caolan/async/issues/806)) +- Added `during` and `doDuring`, which are like `whilst` with an async truth test. ([#800](https://github.com/caolan/async/issues/800)) +- `retry` now accepts an `interval` parameter to specify a delay between retries. ([#793](https://github.com/caolan/async/issues/793)) +- `async` should work better in Web Workers due to better `root` detection ([#804](https://github.com/caolan/async/issues/804)) +- Callbacks are now optional in `whilst`, `doWhilst`, `until`, and `doUntil` ([#642](https://github.com/caolan/async/issues/642)) +- Various internal updates ([#786](https://github.com/caolan/async/issues/786), [#801](https://github.com/caolan/async/issues/801), [#802](https://github.com/caolan/async/issues/802), [#803](https://github.com/caolan/async/issues/803)) +- Various doc fixes ([#790](https://github.com/caolan/async/issues/790), [#794](https://github.com/caolan/async/issues/794)) Bug Fixes: -- `cargo` now exposes the `payload` size, and `cargo.payload` can be changed on the fly after the `cargo` is created. (#740, #744, #783) +- `cargo` now exposes the `payload` size, and `cargo.payload` can be changed on the fly after the `cargo` is created. ([#740](https://github.com/caolan/async/issues/740), [#744](https://github.com/caolan/async/issues/744), [#783](https://github.com/caolan/async/issues/783)) # v1.2.1 Bug Fix: -- Small regression with synchronous iterator behavior in `eachSeries` with a 1-element array. Before 1.1.0, `eachSeries`'s callback was called on the same tick, which this patch restores. In 2.0.0, it will be called on the next tick. (#782) +- Small regression with synchronous iterator behavior in `eachSeries` with a 1-element array. Before 1.1.0, `eachSeries`'s callback was called on the same tick, which this patch restores. In 2.0.0, it will be called on the next tick. ([#782](https://github.com/caolan/async/issues/782)) # v1.2.0 New Features: -- Added `timesLimit` (#743) -- `concurrency` can be changed after initialization in `queue` by setting `q.concurrency`. The new concurrency will be reflected the next time a task is processed. (#747, #772) +- Added `timesLimit` ([#743](https://github.com/caolan/async/issues/743)) +- `concurrency` can be changed after initialization in `queue` by setting `q.concurrency`. The new concurrency will be reflected the next time a task is processed. ([#747](https://github.com/caolan/async/issues/747), [#772](https://github.com/caolan/async/issues/772)) Bug Fixes: -- Fixed a regression in `each` and family with empty arrays that have additional properties. (#775, #777) +- Fixed a regression in `each` and family with empty arrays that have additional properties. ([#775](https://github.com/caolan/async/issues/775), [#777](https://github.com/caolan/async/issues/777)) # v1.1.1 Bug Fix: -- Small regression with synchronous iterator behavior in `eachSeries` with a 1-element array. Before 1.1.0, `eachSeries`'s callback was called on the same tick, which this patch restores. In 2.0.0, it will be called on the next tick. (#782) +- Small regression with synchronous iterator behavior in `eachSeries` with a 1-element array. Before 1.1.0, `eachSeries`'s callback was called on the same tick, which this patch restores. In 2.0.0, it will be called on the next tick. ([#782](https://github.com/caolan/async/issues/782)) # v1.1.0 @@ -202,23 +211,23 @@ Bug Fix: New Features: - `cargo` now supports all of the same methods and event callbacks as `queue`. -- Added `ensureAsync` - A wrapper that ensures an async function calls its callback on a later tick. (#769) +- Added `ensureAsync` - A wrapper that ensures an async function calls its callback on a later tick. ([#769](https://github.com/caolan/async/issues/769)) - Optimized `map`, `eachOf`, and `waterfall` families of functions -- Passing a `null` or `undefined` array to `map`, `each`, `parallel` and families will be treated as an empty array (#667). -- The callback is now optional for the composed results of `compose` and `seq`. (#618) +- Passing a `null` or `undefined` array to `map`, `each`, `parallel` and families will be treated as an empty array ([#667](https://github.com/caolan/async/issues/667)). +- The callback is now optional for the composed results of `compose` and `seq`. ([#618](https://github.com/caolan/async/issues/618)) - Reduced file size by 4kb, (minified version by 1kb) -- Added code coverage through `nyc` and `coveralls` (#768) +- Added code coverage through `nyc` and `coveralls` ([#768](https://github.com/caolan/async/issues/768)) Bug Fixes: -- `forever` will no longer stack overflow with a synchronous iterator (#622) -- `eachLimit` and other limit functions will stop iterating once an error occurs (#754) -- Always pass `null` in callbacks when there is no error (#439) -- Ensure proper conditions when calling `drain()` after pushing an empty data set to a queue (#668) -- `each` and family will properly handle an empty array (#578) -- `eachSeries` and family will finish if the underlying array is modified during execution (#557) -- `queue` will throw if a non-function is passed to `q.push()` (#593) -- Doc fixes (#629, #766) +- `forever` will no longer stack overflow with a synchronous iterator ([#622](https://github.com/caolan/async/issues/622)) +- `eachLimit` and other limit functions will stop iterating once an error occurs ([#754](https://github.com/caolan/async/issues/754)) +- Always pass `null` in callbacks when there is no error ([#439](https://github.com/caolan/async/issues/439)) +- Ensure proper conditions when calling `drain()` after pushing an empty data set to a queue ([#668](https://github.com/caolan/async/issues/668)) +- `each` and family will properly handle an empty array ([#578](https://github.com/caolan/async/issues/578)) +- `eachSeries` and family will finish if the underlying array is modified during execution ([#557](https://github.com/caolan/async/issues/557)) +- `queue` will throw if a non-function is passed to `q.push()` ([#593](https://github.com/caolan/async/issues/593)) +- Doc fixes ([#629](https://github.com/caolan/async/issues/629), [#766](https://github.com/caolan/async/issues/766)) # v1.0.0 @@ -228,12 +237,12 @@ No known breaking changes, we are simply complying with semver from here on out. Changes: - Start using a changelog! -- Add `forEachOf` for iterating over Objects (or to iterate Arrays with indexes available) (#168 #704 #321) -- Detect deadlocks in `auto` (#663) -- Better support for require.js (#527) -- Throw if queue created with concurrency `0` (#714) -- Fix unneeded iteration in `queue.resume()` (#758) -- Guard against timer mocking overriding `setImmediate` (#609 #611) -- Miscellaneous doc fixes (#542 #596 #615 #628 #631 #690 #729) -- Use single noop function internally (#546) +- Add `forEachOf` for iterating over Objects (or to iterate Arrays with indexes available) ([#168](https://github.com/caolan/async/issues/168) [#704](https://github.com/caolan/async/issues/704) [#321](https://github.com/caolan/async/issues/321)) +- Detect deadlocks in `auto` ([#663](https://github.com/caolan/async/issues/663)) +- Better support for require.js ([#527](https://github.com/caolan/async/issues/527)) +- Throw if queue created with concurrency `0` ([#714](https://github.com/caolan/async/issues/714)) +- Fix unneeded iteration in `queue.resume()` ([#758](https://github.com/caolan/async/issues/758)) +- Guard against timer mocking overriding `setImmediate` ([#609](https://github.com/caolan/async/issues/609) [#611](https://github.com/caolan/async/issues/611)) +- Miscellaneous doc fixes ([#542](https://github.com/caolan/async/issues/542) [#596](https://github.com/caolan/async/issues/596) [#615](https://github.com/caolan/async/issues/615) [#628](https://github.com/caolan/async/issues/628) [#631](https://github.com/caolan/async/issues/631) [#690](https://github.com/caolan/async/issues/690) [#729](https://github.com/caolan/async/issues/729)) +- Use single noop function internally ([#546](https://github.com/caolan/async/issues/546)) - Optimize internal `_each`, `_map` and `_keys` functions. diff --git a/node_modules/async/apply.js b/node_modules/async/apply.js index 8e6d6e6e4..f590fa574 100644 --- a/node_modules/async/apply.js +++ b/node_modules/async/apply.js @@ -4,12 +4,22 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _rest = require('./internal/rest'); +exports.default = function (fn /*, ...args*/) { + var args = (0, _slice2.default)(arguments, 1); + return function () /*callArgs*/{ + var callArgs = (0, _slice2.default)(arguments); + return fn.apply(null, args.concat(callArgs)); + }; +}; + +var _slice = require('./internal/slice'); -var _rest2 = _interopRequireDefault(_rest); +var _slice2 = _interopRequireDefault(_slice); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +; + /** * Creates a continuation function with some arguments already applied. * @@ -22,10 +32,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * @memberOf module:Utils * @method * @category Util - * @param {Function} function - The function you want to eventually apply all + * @param {Function} fn - The function you want to eventually apply all * arguments to. Invokes with (arguments...). * @param {...*} arguments... - Any number of arguments to automatically apply * when the continuation is called. + * @returns {Function} the partially-applied function * @example * * // using apply @@ -54,9 +65,4 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * two * three */ -exports.default = (0, _rest2.default)(function (fn, args) { - return (0, _rest2.default)(function (callArgs) { - return fn.apply(null, args.concat(callArgs)); - }); -}); module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/async/asyncify.js b/node_modules/async/asyncify.js index 2c8e77a77..5e3fc9155 100644 --- a/node_modules/async/asyncify.js +++ b/node_modules/async/asyncify.js @@ -13,6 +13,10 @@ var _initialParams = require('./internal/initialParams'); var _initialParams2 = _interopRequireDefault(_initialParams); +var _setImmediate = require('./internal/setImmediate'); + +var _setImmediate2 = _interopRequireDefault(_setImmediate); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** @@ -34,7 +38,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * @method * @alias wrapSync * @category Util - * @param {Function} func - The synchronous funuction, or Promise-returning + * @param {Function} func - The synchronous function, or Promise-returning * function to convert to an {@link AsyncFunction}. * @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be * invoked with `(args..., callback)`. @@ -82,13 +86,25 @@ function asyncify(func) { // if result is Promise object if ((0, _isObject2.default)(result) && typeof result.then === 'function') { result.then(function (value) { - callback(null, value); + invokeCallback(callback, null, value); }, function (err) { - callback(err.message ? err : new Error(err)); + invokeCallback(callback, err.message ? err : new Error(err)); }); } else { callback(null, result); } }); } + +function invokeCallback(callback, error, value) { + try { + callback(error, value); + } catch (e) { + (0, _setImmediate2.default)(rethrow, e); + } +} + +function rethrow(error) { + throw error; +} module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/async/auto.js b/node_modules/async/auto.js index 2b6d73739..26c1d562c 100644 --- a/node_modules/async/auto.js +++ b/node_modules/async/auto.js @@ -102,26 +102,26 @@ exports.default = function (tasks, concurrency, callback) { function runTask(key, task) { if (hasError) return; - var taskCallback = (0, _onlyOnce2.default)((0, _rest2.default)(function (err, args) { + var taskCallback = (0, _onlyOnce2.default)(function (err, result) { runningTasks--; - if (args.length <= 1) { - args = args[0]; + if (arguments.length > 2) { + result = (0, _slice2.default)(arguments, 1); } if (err) { var safeResults = {}; (0, _baseForOwn2.default)(results, function (val, rkey) { safeResults[rkey] = val; }); - safeResults[key] = args; + safeResults[key] = result; hasError = true; listeners = Object.create(null); callback(err, safeResults); } else { - results[key] = args; + results[key] = result; taskComplete(key); } - })); + }); runningTasks++; var taskFn = (0, _wrapAsync2.default)(task[task.length - 1]); @@ -188,9 +188,9 @@ var _noop = require('lodash/noop'); var _noop2 = _interopRequireDefault(_noop); -var _rest = require('./internal/rest'); +var _slice = require('./internal/slice'); -var _rest2 = _interopRequireDefault(_rest); +var _slice2 = _interopRequireDefault(_slice); var _once = require('./internal/once'); diff --git a/node_modules/async/compose.js b/node_modules/async/compose.js index 7373e110d..47c49f62d 100644 --- a/node_modules/async/compose.js +++ b/node_modules/async/compose.js @@ -4,16 +4,22 @@ Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = function () /*...args*/{ + return _seq2.default.apply(null, (0, _slice2.default)(arguments).reverse()); +}; + var _seq = require('./seq'); var _seq2 = _interopRequireDefault(_seq); -var _rest = require('./internal/rest'); +var _slice = require('./internal/slice'); -var _rest2 = _interopRequireDefault(_rest); +var _slice2 = _interopRequireDefault(_slice); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +; + /** * Creates a function which is a composition of the passed asynchronous * functions. Each function consumes the return value of the function that @@ -49,7 +55,4 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * // result now equals 15 * }); */ -exports.default = (0, _rest2.default)(function (args) { - return _seq2.default.apply(null, args.reverse()); -}); module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/async/constant.js b/node_modules/async/constant.js index 05903def6..c825475bd 100644 --- a/node_modules/async/constant.js +++ b/node_modules/async/constant.js @@ -4,16 +4,23 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _rest = require('./internal/rest'); - -var _rest2 = _interopRequireDefault(_rest); +exports.default = function () /*...values*/{ + var values = (0, _slice2.default)(arguments); + var args = [null].concat(values); + return function () /*...ignoredArgs, callback*/{ + var callback = arguments[arguments.length - 1]; + return callback.apply(this, args); + }; +}; -var _initialParams = require('./internal/initialParams'); +var _slice = require('./internal/slice'); -var _initialParams2 = _interopRequireDefault(_initialParams); +var _slice2 = _interopRequireDefault(_slice); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +; + /** * Returns a function that when called, calls-back with the values provided. * Useful as the first function in a [`waterfall`]{@link module:ControlFlow.waterfall}, or for plugging values in to @@ -56,10 +63,4 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * //... * }, callback); */ -exports.default = (0, _rest2.default)(function (values) { - var args = [null].concat(values); - return (0, _initialParams2.default)(function (ignoredArgs, callback) { - return callback.apply(this, args); - }); -}); module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/async/dist/async.js b/node_modules/async/dist/async.js index 4d2aa0882..a0f30b0d4 100644 --- a/node_modules/async/dist/async.js +++ b/node_modules/async/dist/async.js @@ -1,93 +1,25 @@ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (factory((global.async = global.async || {}))); + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.async = global.async || {}))); }(this, (function (exports) { 'use strict'; -/** - * A faster alternative to `Function#apply`, this function invokes `func` - * with the `this` binding of `thisArg` and the arguments of `args`. - * - * @private - * @param {Function} func The function to invoke. - * @param {*} thisArg The `this` binding of `func`. - * @param {Array} args The arguments to invoke `func` with. - * @returns {*} Returns the result of `func`. - */ -function apply(func, thisArg, args) { - switch (args.length) { - case 0: return func.call(thisArg); - case 1: return func.call(thisArg, args[0]); - case 2: return func.call(thisArg, args[0], args[1]); - case 3: return func.call(thisArg, args[0], args[1], args[2]); - } - return func.apply(thisArg, args); -} - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max; - -/** - * A specialized version of `baseRest` which transforms the rest array. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @param {Function} transform The rest array transform. - * @returns {Function} Returns the new function. - */ -function overRest$1(func, start, transform) { - start = nativeMax(start === undefined ? (func.length - 1) : start, 0); - return function() { - var args = arguments, - index = -1, - length = nativeMax(args.length - start, 0), - array = Array(length); - - while (++index < length) { - array[index] = args[start + index]; - } - index = -1; - var otherArgs = Array(start + 1); - while (++index < start) { - otherArgs[index] = args[index]; +function slice(arrayLike, start) { + start = start|0; + var newLen = Math.max(arrayLike.length - start, 0); + var newArr = Array(newLen); + for(var idx = 0; idx < newLen; idx++) { + newArr[idx] = arrayLike[start + idx]; } - otherArgs[start] = transform(array); - return apply(func, this, otherArgs); - }; -} - -/** - * This method returns the first argument it receives. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'a': 1 }; - * - * console.log(_.identity(object) === object); - * // => true - */ -function identity(value) { - return value; -} - -// Lodash rest function without function.toString() -// remappings -function rest(func, start) { - return overRest$1(func, start, identity); + return newArr; } var initialParams = function (fn) { - return rest(function (args /*..., callback*/) { + return function (/*...args, callback*/) { + var args = slice(arguments); var callback = args.pop(); fn.call(this, args, callback); - }); + }; }; /** @@ -120,6 +52,34 @@ function isObject(value) { return value != null && (type == 'object' || type == 'function'); } +var hasSetImmediate = typeof setImmediate === 'function' && setImmediate; +var hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function'; + +function fallback(fn) { + setTimeout(fn, 0); +} + +function wrap(defer) { + return function (fn/*, ...args*/) { + var args = slice(arguments, 1); + defer(function () { + fn.apply(null, args); + }); + }; +} + +var _defer; + +if (hasSetImmediate) { + _defer = setImmediate; +} else if (hasNextTick) { + _defer = process.nextTick; +} else { + _defer = fallback; +} + +var setImmediate$1 = wrap(_defer); + /** * Take a sync function and make it async, passing its return value to a * callback. This is useful for plugging sync functions into a waterfall, @@ -139,7 +99,7 @@ function isObject(value) { * @method * @alias wrapSync * @category Util - * @param {Function} func - The synchronous funuction, or Promise-returning + * @param {Function} func - The synchronous function, or Promise-returning * function to convert to an {@link AsyncFunction}. * @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be * invoked with `(args..., callback)`. @@ -186,10 +146,10 @@ function asyncify(func) { } // if result is Promise object if (isObject(result) && typeof result.then === 'function') { - result.then(function (value) { - callback(null, value); - }, function (err) { - callback(err.message ? err : new Error(err)); + result.then(function(value) { + invokeCallback(callback, null, value); + }, function(err) { + invokeCallback(callback, err.message ? err : new Error(err)); }); } else { callback(null, result); @@ -197,19 +157,20 @@ function asyncify(func) { }); } -var supportsSymbol = typeof Symbol === 'function'; - -function supportsAsync() { - var supported; +function invokeCallback(callback, error, value) { try { - /* eslint no-eval: 0 */ - supported = isAsync(eval('(async function () {})')); + callback(error, value); } catch (e) { - supported = false; + setImmediate$1(rethrow, e); } - return supported; } +function rethrow(error) { + throw error; +} + +var supportsSymbol = typeof Symbol === 'function'; + function isAsync(fn) { return supportsSymbol && fn[Symbol.toStringTag] === 'AsyncFunction'; } @@ -218,22 +179,22 @@ function wrapAsync(asyncFn) { return isAsync(asyncFn) ? asyncify(asyncFn) : asyncFn; } -var wrapAsync$1 = supportsAsync() ? wrapAsync : identity; - function applyEach$1(eachfn) { - return rest(function (fns, args) { - var go = initialParams(function (args, callback) { + return function(fns/*, ...args*/) { + var args = slice(arguments, 1); + var go = initialParams(function(args, callback) { var that = this; return eachfn(fns, function (fn, cb) { - wrapAsync$1(fn).apply(that, args.concat(cb)); + wrapAsync(fn).apply(that, args.concat(cb)); }, callback); }); if (args.length) { return go.apply(this, args); - } else { + } + else { return go; } - }); + }; } /** Detect free variable `global` from Node.js. */ @@ -903,18 +864,19 @@ function createArrayIterator(coll) { var i = -1; var len = coll.length; return function next() { - return ++i < len ? { value: coll[i], key: i } : null; - }; + return ++i < len ? {value: coll[i], key: i} : null; + } } function createES2015Iterator(iterator) { var i = -1; return function next() { var item = iterator.next(); - if (item.done) return null; + if (item.done) + return null; i++; - return { value: item.value, key: i }; - }; + return {value: item.value, key: i}; + } } function createObjectIterator(obj) { @@ -923,7 +885,7 @@ function createObjectIterator(obj) { var len = okeys.length; return function next() { var key = okeys[++i]; - return i < len ? { value: obj[key], key: key } : null; + return i < len ? {value: obj[key], key: key} : null; }; } @@ -937,7 +899,7 @@ function iterator(coll) { } function onlyOnce(fn) { - return function () { + return function() { if (fn === null) throw new Error("Callback was already called."); var callFn = fn; fn = null; @@ -960,15 +922,17 @@ function _eachOfLimit(limit) { if (err) { done = true; callback(err); - } else if (value === breakLoop || done && running <= 0) { + } + else if (value === breakLoop || (done && running <= 0)) { done = true; return callback(null); - } else { + } + else { replenish(); } } - function replenish() { + function replenish () { while (running < limit && !done) { var elem = nextElem(); if (elem === null) { @@ -1008,7 +972,7 @@ function _eachOfLimit(limit) { * `iteratee` functions have finished, or an error occurs. Invoked with (err). */ function eachOfLimit(coll, limit, iteratee, callback) { - _eachOfLimit(limit)(coll, wrapAsync$1(iteratee), callback); + _eachOfLimit(limit)(coll, wrapAsync(iteratee), callback); } function doLimit(fn, limit) { @@ -1030,7 +994,7 @@ function eachOfArrayLike(coll, iteratee, callback) { function iteratorCallback(err, value) { if (err) { callback(err); - } else if (++completed === length || value === breakLoop) { + } else if ((++completed === length) || value === breakLoop) { callback(null); } } @@ -1082,14 +1046,14 @@ var eachOfGeneric = doLimit(eachOfLimit, Infinity); * doSomethingWith(configs); * }); */ -var eachOf = function (coll, iteratee, callback) { +var eachOf = function(coll, iteratee, callback) { var eachOfImplementation = isArrayLike(coll) ? eachOfArrayLike : eachOfGeneric; - eachOfImplementation(coll, wrapAsync$1(iteratee), callback); + eachOfImplementation(coll, wrapAsync(iteratee), callback); }; function doParallel(fn) { return function (obj, iteratee, callback) { - return fn(eachOf, obj, wrapAsync$1(iteratee), callback); + return fn(eachOf, obj, wrapAsync(iteratee), callback); }; } @@ -1098,7 +1062,7 @@ function _asyncMap(eachfn, arr, iteratee, callback) { arr = arr || []; var results = []; var counter = 0; - var _iteratee = wrapAsync$1(iteratee); + var _iteratee = wrapAsync(iteratee); eachfn(arr, function (value, _, callback) { var index = counter++; @@ -1186,7 +1150,7 @@ var applyEach = applyEach$1(map); function doParallelLimit(fn) { return function (obj, limit, iteratee, callback) { - return fn(_eachOfLimit(limit), obj, wrapAsync$1(iteratee), callback); + return fn(_eachOfLimit(limit), obj, wrapAsync(iteratee), callback); }; } @@ -1264,10 +1228,11 @@ var applyEachSeries = applyEach$1(mapSeries); * @memberOf module:Utils * @method * @category Util - * @param {Function} function - The function you want to eventually apply all + * @param {Function} fn - The function you want to eventually apply all * arguments to. Invokes with (arguments...). * @param {...*} arguments... - Any number of arguments to automatically apply * when the continuation is called. + * @returns {Function} the partially-applied function * @example * * // using apply @@ -1296,11 +1261,13 @@ var applyEachSeries = applyEach$1(mapSeries); * two * three */ -var apply$2 = rest(function (fn, args) { - return rest(function (callArgs) { +var apply = function(fn/*, ...args*/) { + var args = slice(arguments, 1); + return function(/*callArgs*/) { + var callArgs = slice(arguments); return fn.apply(null, args.concat(callArgs)); - }); -}); + }; +}; /** * A specialized version of `_.forEach` for arrays without support for @@ -1570,7 +1537,10 @@ var auto = function (tasks, concurrency, callback) { arrayEach(dependencies, function (dependencyName) { if (!tasks[dependencyName]) { - throw new Error('async.auto task `' + key + '` has a non-existent dependency `' + dependencyName + '` in ' + dependencies.join(', ')); + throw new Error('async.auto task `' + key + + '` has a non-existent dependency `' + + dependencyName + '` in ' + + dependencies.join(', ')); } addListener(dependencyName, function () { remainingDependencies--; @@ -1594,10 +1564,11 @@ var auto = function (tasks, concurrency, callback) { if (readyTasks.length === 0 && runningTasks === 0) { return callback(null, results); } - while (readyTasks.length && runningTasks < concurrency) { + while(readyTasks.length && runningTasks < concurrency) { var run = readyTasks.shift(); run(); } + } function addListener(taskName, fn) { @@ -1617,32 +1588,33 @@ var auto = function (tasks, concurrency, callback) { processQueue(); } + function runTask(key, task) { if (hasError) return; - var taskCallback = onlyOnce(rest(function (err, args) { + var taskCallback = onlyOnce(function(err, result) { runningTasks--; - if (args.length <= 1) { - args = args[0]; + if (arguments.length > 2) { + result = slice(arguments, 1); } if (err) { var safeResults = {}; - baseForOwn(results, function (val, rkey) { + baseForOwn(results, function(val, rkey) { safeResults[rkey] = val; }); - safeResults[key] = args; + safeResults[key] = result; hasError = true; listeners = Object.create(null); callback(err, safeResults); } else { - results[key] = args; + results[key] = result; taskComplete(key); } - })); + }); runningTasks++; - var taskFn = wrapAsync$1(task[task.length - 1]); + var taskFn = wrapAsync(task[task.length - 1]); if (task.length > 1) { taskFn(results, taskCallback); } else { @@ -1667,7 +1639,9 @@ var auto = function (tasks, concurrency, callback) { } if (counter !== numTasks) { - throw new Error('async.auto cannot execute tasks due to a recursive dependency'); + throw new Error( + 'async.auto cannot execute tasks due to a recursive dependency' + ); } } @@ -1995,7 +1969,7 @@ function parseParams(func) { func = func.toString().replace(STRIP_COMMENTS, ''); func = func.match(FN_ARGS)[2].replace(' ', ''); func = func ? func.split(FN_ARG_SPLIT) : []; - func = func.map(function (arg) { + func = func.map(function (arg){ return trim(arg.replace(FN_ARG, '')); }); return func; @@ -2089,7 +2063,9 @@ function autoInject(tasks, callback) { baseForOwn(tasks, function (taskFn, key) { var params; var fnIsAsync = isAsync(taskFn); - var hasNoDeps = !fnIsAsync && taskFn.length === 1 || fnIsAsync && taskFn.length === 0; + var hasNoDeps = + (!fnIsAsync && taskFn.length === 1) || + (fnIsAsync && taskFn.length === 0); if (isArray(taskFn)) { params = taskFn.slice(0, -1); @@ -2116,40 +2092,13 @@ function autoInject(tasks, callback) { return results[name]; }); newArgs.push(taskCb); - wrapAsync$1(taskFn).apply(null, newArgs); + wrapAsync(taskFn).apply(null, newArgs); } }); auto(newTasks, callback); } -var hasSetImmediate = typeof setImmediate === 'function' && setImmediate; -var hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function'; - -function fallback(fn) { - setTimeout(fn, 0); -} - -function wrap(defer) { - return rest(function (fn, args) { - defer(function () { - fn.apply(null, args); - }); - }); -} - -var _defer; - -if (hasSetImmediate) { - _defer = setImmediate; -} else if (hasNextTick) { - _defer = process.nextTick; -} else { - _defer = fallback; -} - -var setImmediate$1 = wrap(_defer); - // Simple doubly linked list (https://en.wikipedia.org/wiki/Doubly_linked_list) implementation // used for queues. This implementation assumes that the node provided by the user can be modified // to adjust the next and last properties. We implement only the minimal functionality @@ -2164,57 +2113,89 @@ function setInitial(dll, node) { dll.head = dll.tail = node; } -DLL.prototype.removeLink = function (node) { - if (node.prev) node.prev.next = node.next;else this.head = node.next; - if (node.next) node.next.prev = node.prev;else this.tail = node.prev; +DLL.prototype.removeLink = function(node) { + if (node.prev) node.prev.next = node.next; + else this.head = node.next; + if (node.next) node.next.prev = node.prev; + else this.tail = node.prev; node.prev = node.next = null; this.length -= 1; return node; }; -DLL.prototype.empty = DLL; +DLL.prototype.empty = function () { + while(this.head) this.shift(); + return this; +}; -DLL.prototype.insertAfter = function (node, newNode) { +DLL.prototype.insertAfter = function(node, newNode) { newNode.prev = node; newNode.next = node.next; - if (node.next) node.next.prev = newNode;else this.tail = newNode; + if (node.next) node.next.prev = newNode; + else this.tail = newNode; node.next = newNode; this.length += 1; }; -DLL.prototype.insertBefore = function (node, newNode) { +DLL.prototype.insertBefore = function(node, newNode) { newNode.prev = node.prev; newNode.next = node; - if (node.prev) node.prev.next = newNode;else this.head = newNode; + if (node.prev) node.prev.next = newNode; + else this.head = newNode; node.prev = newNode; this.length += 1; }; -DLL.prototype.unshift = function (node) { - if (this.head) this.insertBefore(this.head, node);else setInitial(this, node); +DLL.prototype.unshift = function(node) { + if (this.head) this.insertBefore(this.head, node); + else setInitial(this, node); }; -DLL.prototype.push = function (node) { - if (this.tail) this.insertAfter(this.tail, node);else setInitial(this, node); +DLL.prototype.push = function(node) { + if (this.tail) this.insertAfter(this.tail, node); + else setInitial(this, node); }; -DLL.prototype.shift = function () { +DLL.prototype.shift = function() { return this.head && this.removeLink(this.head); }; -DLL.prototype.pop = function () { +DLL.prototype.pop = function() { return this.tail && this.removeLink(this.tail); }; +DLL.prototype.toArray = function () { + var arr = Array(this.length); + var curr = this.head; + for(var idx = 0; idx < this.length; idx++) { + arr[idx] = curr.data; + curr = curr.next; + } + return arr; +}; + +DLL.prototype.remove = function (testFn) { + var curr = this.head; + while(!!curr) { + var next = curr.next; + if (testFn(curr)) { + this.removeLink(curr); + } + curr = next; + } + return this; +}; + function queue(worker, concurrency, payload) { if (concurrency == null) { concurrency = 1; - } else if (concurrency === 0) { + } + else if(concurrency === 0) { throw new Error('Concurrency must not be zero'); } - var _worker = wrapAsync$1(worker); + var _worker = wrapAsync(worker); var numRunning = 0; var workersList = []; @@ -2228,7 +2209,7 @@ function queue(worker, concurrency, payload) { } if (data.length === 0 && q.idle()) { // call drain immediately if there are no tasks - return setImmediate$1(function () { + return setImmediate$1(function() { q.drain(); }); } @@ -2249,7 +2230,7 @@ function queue(worker, concurrency, payload) { } function _next(tasks) { - return rest(function (args) { + return function(err){ numRunning -= 1; for (var i = 0, l = tasks.length; i < l; i++) { @@ -2259,14 +2240,14 @@ function queue(worker, concurrency, payload) { workersList.splice(index); } - task.callback.apply(task, args); + task.callback.apply(task, arguments); - if (args[0] != null) { - q.error(args[0], task.data); + if (err != null) { + q.error(err, task.data); } } - if (numRunning <= q.concurrency - q.buffer) { + if (numRunning <= (q.concurrency - q.buffer) ) { q.unsaturated(); } @@ -2274,7 +2255,7 @@ function queue(worker, concurrency, payload) { q.drain(); } q.process(); - }); + }; } var isProcessing = false; @@ -2283,7 +2264,7 @@ function queue(worker, concurrency, payload) { concurrency: concurrency, payload: payload, saturated: noop, - unsaturated: noop, + unsaturated:noop, buffer: concurrency / 4, empty: noop, drain: noop, @@ -2300,6 +2281,9 @@ function queue(worker, concurrency, payload) { unshift: function (data, callback) { _insert(data, true, callback); }, + remove: function (testFn) { + q._tasks.remove(testFn); + }, process: function () { // Avoid trying to start too many processing operations. This can occur // when callbacks resolve synchronously (#1267). @@ -2307,9 +2291,8 @@ function queue(worker, concurrency, payload) { return; } isProcessing = true; - while (!q.paused && numRunning < q.concurrency && q._tasks.length) { - var tasks = [], - data = []; + while(!q.paused && numRunning < q.concurrency && q._tasks.length){ + var tasks = [], data = []; var l = q._tasks.length; if (q.payload) l = Math.min(l, q.payload); for (var i = 0; i < l; i++) { @@ -2318,11 +2301,12 @@ function queue(worker, concurrency, payload) { data.push(node.data); } + numRunning += 1; + workersList.push(tasks[0]); + if (q._tasks.length === 0) { q.empty(); } - numRunning += 1; - workersList.push(tasks[0]); if (numRunning === q.concurrency) { q.saturated(); @@ -2342,16 +2326,14 @@ function queue(worker, concurrency, payload) { workersList: function () { return workersList; }, - idle: function () { + idle: function() { return q._tasks.length + numRunning === 0; }, pause: function () { q.paused = true; }, resume: function () { - if (q.paused === false) { - return; - } + if (q.paused === false) { return; } q.paused = false; setImmediate$1(q.process); } @@ -2437,7 +2419,7 @@ function queue(worker, concurrency, payload) { * }); */ function cargo(worker, payload) { - return queue(worker, 1, payload); + return queue(worker, 1, payload); } /** @@ -2501,13 +2483,13 @@ var eachOfSeries = doLimit(eachOfLimit, 1); */ function reduce(coll, memo, iteratee, callback) { callback = once(callback || noop); - var _iteratee = wrapAsync$1(iteratee); - eachOfSeries(coll, function (x, i, callback) { - _iteratee(memo, x, function (err, v) { + var _iteratee = wrapAsync(iteratee); + eachOfSeries(coll, function(x, i, callback) { + _iteratee(memo, x, function(err, v) { memo = v; callback(err); }); - }, function (err) { + }, function(err) { callback(err, memo); }); } @@ -2550,9 +2532,10 @@ function reduce(coll, memo, iteratee, callback) { * }); * }); */ -var seq$1 = rest(function seq(functions) { - var _functions = arrayMap(functions, wrapAsync$1); - return rest(function (args) { +function seq(/*...functions*/) { + var _functions = arrayMap(arguments, wrapAsync); + return function(/*...args*/) { + var args = slice(arguments); var that = this; var cb = args[args.length - 1]; @@ -2562,15 +2545,17 @@ var seq$1 = rest(function seq(functions) { cb = noop; } - reduce(_functions, args, function (newargs, fn, cb) { - fn.apply(that, newargs.concat(rest(function (err, nextargs) { + reduce(_functions, args, function(newargs, fn, cb) { + fn.apply(that, newargs.concat(function(err/*, ...nextargs*/) { + var nextargs = slice(arguments, 1); cb(err, nextargs); - }))); - }, function (err, results) { + })); + }, + function(err, results) { cb.apply(that, [err].concat(results)); }); - }); -}); + }; +} /** * Creates a function which is a composition of the passed asynchronous @@ -2607,9 +2592,9 @@ var seq$1 = rest(function seq(functions) { * // result now equals 15 * }); */ -var compose = rest(function (args) { - return seq$1.apply(null, args.reverse()); -}); +var compose = function(/*...args*/) { + return seq.apply(null, slice(arguments).reverse()); +}; function concat$1(eachfn, arr, fn, callback) { var result = []; @@ -2652,7 +2637,7 @@ var concat = doParallel(concat$1); function doSeries(fn) { return function (obj, iteratee, callback) { - return fn(eachOfSeries, obj, wrapAsync$1(iteratee), callback); + return fn(eachOfSeries, obj, wrapAsync(iteratee), callback); }; } @@ -2718,20 +2703,42 @@ var concatSeries = doSeries(concat$1); * //... * }, callback); */ -var constant = rest(function (values) { +var constant = function(/*...values*/) { + var values = slice(arguments); var args = [null].concat(values); - return initialParams(function (ignoredArgs, callback) { + return function (/*...ignoredArgs, callback*/) { + var callback = arguments[arguments.length - 1]; return callback.apply(this, args); - }); -}); + }; +}; + +/** + * This method returns the first argument it receives. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'a': 1 }; + * + * console.log(_.identity(object) === object); + * // => true + */ +function identity(value) { + return value; +} function _createTester(check, getResult) { - return function (eachfn, arr, iteratee, cb) { + return function(eachfn, arr, iteratee, cb) { cb = cb || noop; var testPassed = false; var testResult; - eachfn(arr, function (value, _, callback) { - iteratee(value, function (err, result) { + eachfn(arr, function(value, _, callback) { + iteratee(value, function(err, result) { if (err) { callback(err); } else if (check(result) && !testResult) { @@ -2742,7 +2749,7 @@ function _createTester(check, getResult) { callback(); } }); - }, function (err) { + }, function(err) { if (err) { cb(err); } else { @@ -2840,8 +2847,10 @@ var detectLimit = doParallelLimit(_createTester(identity, _findGetResult)); var detectSeries = doLimit(detectLimit, 1); function consoleFunc(name) { - return rest(function (fn, args) { - wrapAsync$1(fn).apply(null, args.concat(rest(function (err, args) { + return function (fn/*, ...args*/) { + var args = slice(arguments, 1); + args.push(function (err/*, ...args*/) { + var args = slice(arguments, 1); if (typeof console === 'object') { if (err) { if (console.error) { @@ -2853,8 +2862,9 @@ function consoleFunc(name) { }); } } - }))); - }); + }); + wrapAsync(fn).apply(null, args); + }; } /** @@ -2910,14 +2920,15 @@ var dir = consoleFunc('dir'); */ function doDuring(fn, test, callback) { callback = onlyOnce(callback || noop); - var _fn = wrapAsync$1(fn); - var _test = wrapAsync$1(test); + var _fn = wrapAsync(fn); + var _test = wrapAsync(test); - var next = rest(function (err, args) { + function next(err/*, ...args*/) { if (err) return callback(err); + var args = slice(arguments, 1); args.push(check); _test.apply(this, args); - }); + } function check(err, truth) { if (err) return callback(err); @@ -2926,6 +2937,7 @@ function doDuring(fn, test, callback) { } check(null, true); + } /** @@ -2952,12 +2964,13 @@ function doDuring(fn, test, callback) { */ function doWhilst(iteratee, test, callback) { callback = onlyOnce(callback || noop); - var _iteratee = wrapAsync$1(iteratee); - var next = rest(function (err, args) { + var _iteratee = wrapAsync(iteratee); + var next = function(err/*, ...args*/) { if (err) return callback(err); + var args = slice(arguments, 1); if (test.apply(this, args)) return _iteratee(next); callback.apply(null, [null].concat(args)); - }); + }; _iteratee(next); } @@ -2982,7 +2995,7 @@ function doWhilst(iteratee, test, callback) { * callback. Invoked with (err, [results]); */ function doUntil(iteratee, test, callback) { - doWhilst(iteratee, function () { + doWhilst(iteratee, function() { return !test.apply(this, arguments); }, callback); } @@ -3025,8 +3038,8 @@ function doUntil(iteratee, test, callback) { */ function during(test, fn, callback) { callback = onlyOnce(callback || noop); - var _fn = wrapAsync$1(fn); - var _test = wrapAsync$1(test); + var _fn = wrapAsync(fn); + var _test = wrapAsync(test); function next(err) { if (err) return callback(err); @@ -3106,7 +3119,7 @@ function _withoutIndex(iteratee) { * }); */ function eachLimit(coll, iteratee, callback) { - eachOf(coll, _withoutIndex(wrapAsync$1(iteratee)), callback); + eachOf(coll, _withoutIndex(wrapAsync(iteratee)), callback); } /** @@ -3130,7 +3143,7 @@ function eachLimit(coll, iteratee, callback) { * `iteratee` functions have finished, or an error occurs. Invoked with (err). */ function eachLimit$1(coll, limit, iteratee, callback) { - _eachOfLimit(limit)(coll, _withoutIndex(wrapAsync$1(iteratee)), callback); + _eachOfLimit(limit)(coll, _withoutIndex(wrapAsync(iteratee)), callback); } /** @@ -3323,7 +3336,7 @@ function filterGeneric(eachfn, coll, iteratee, callback) { callback(err); } else { if (v) { - results.push({ index: index, value: x }); + results.push({index: index, value: x}); } callback(); } @@ -3341,7 +3354,7 @@ function filterGeneric(eachfn, coll, iteratee, callback) { function _filter(eachfn, coll, iteratee, callback) { var filter = isArrayLike(coll) ? filterArray : filterGeneric; - filter(eachfn, coll, wrapAsync$1(iteratee), callback || noop); + filter(eachfn, coll, wrapAsync(iteratee), callback || noop); } /** @@ -3444,7 +3457,7 @@ var filterSeries = doLimit(filterLimit, 1); */ function forever(fn, errback) { var done = onlyOnce(errback || noop); - var task = wrapAsync$1(ensureAsync(fn)); + var task = wrapAsync(ensureAsync(fn)); function next(err) { if (err) return done(err); @@ -3472,15 +3485,15 @@ function forever(fn, errback) { * functions have finished, or an error occurs. Result is an `Object` whoses * properties are arrays of values which returned the corresponding key. */ -var groupByLimit = function (coll, limit, iteratee, callback) { +var groupByLimit = function(coll, limit, iteratee, callback) { callback = callback || noop; - var _iteratee = wrapAsync$1(iteratee); - mapLimit(coll, limit, function (val, callback) { - _iteratee(val, function (err, key) { + var _iteratee = wrapAsync(iteratee); + mapLimit(coll, limit, function(val, callback) { + _iteratee(val, function(err, key) { if (err) return callback(err); - return callback(null, { key: key, val: val }); + return callback(null, {key: key, val: val}); }); - }, function (err, mapResults) { + }, function(err, mapResults) { var result = {}; // from MDN, handle object having an `hasOwnProperty` prop var hasOwnProperty = Object.prototype.hasOwnProperty; @@ -3614,8 +3627,8 @@ var log = consoleFunc('log'); function mapValuesLimit(obj, limit, iteratee, callback) { callback = once(callback || noop); var newObj = {}; - var _iteratee = wrapAsync$1(iteratee); - eachOfLimit(obj, limit, function (val, key, next) { + var _iteratee = wrapAsync(iteratee); + eachOfLimit(obj, limit, function(val, key, next) { _iteratee(val, key, function (err, result) { if (err) return next(err); newObj[key] = result; @@ -3739,25 +3752,26 @@ function memoize(fn, hasher) { var memo = Object.create(null); var queues = Object.create(null); hasher = hasher || identity; - var _fn = wrapAsync$1(fn); + var _fn = wrapAsync(fn); var memoized = initialParams(function memoized(args, callback) { var key = hasher.apply(null, args); if (has(memo, key)) { - setImmediate$1(function () { + setImmediate$1(function() { callback.apply(null, memo[key]); }); } else if (has(queues, key)) { queues[key].push(callback); } else { queues[key] = [callback]; - _fn.apply(null, args.concat(rest(function (args) { + _fn.apply(null, args.concat(function(/*args*/) { + var args = slice(arguments); memo[key] = args; var q = queues[key]; delete queues[key]; for (var i = 0, l = q.length; i < l; i++) { q[i].apply(null, args); } - }))); + })); } }); memoized.memo = memo; @@ -3813,13 +3827,13 @@ function _parallel(eachfn, tasks, callback) { var results = isArrayLike(tasks) ? [] : {}; eachfn(tasks, function (task, key, callback) { - wrapAsync$1(task)(rest(function (err, args) { - if (args.length <= 1) { - args = args[0]; + wrapAsync(task)(function (err, result) { + if (arguments.length > 2) { + result = slice(arguments, 1); } - results[key] = args; + results[key] = result; callback(err); - })); + }); }, function (err) { callback(err, results); }); @@ -3895,7 +3909,7 @@ function _parallel(eachfn, tasks, callback) { * }); */ function parallelLimit(tasks, callback) { - _parallel(eachOf, tasks, callback); + _parallel(eachOf, tasks, callback); } /** @@ -3918,7 +3932,7 @@ function parallelLimit(tasks, callback) { * Invoked with (err, results). */ function parallelLimit$1(tasks, limit, callback) { - _parallel(_eachOfLimit(limit), tasks, callback); + _parallel(_eachOfLimit(limit), tasks, callback); } /** @@ -3944,6 +3958,12 @@ function parallelLimit$1(tasks, limit, callback) { * task in the list. Invoke with `queue.push(task, [callback])`, * @property {Function} unshift - add a new task to the front of the `queue`. * Invoke with `queue.unshift(task, [callback])`. + * @property {Function} remove - remove items from the queue that match a test + * function. The test function will be passed an object with a `data` property, + * and a `priority` property, if this is a + * [priorityQueue]{@link module:ControlFlow.priorityQueue} object. + * Invoked with `queue.remove(testFn)`, where `testFn` is of the form + * `function ({data, priority}) {}` and returns a Boolean. * @property {Function} saturated - a callback that is called when the number of * running workers hits the `concurrency` limit, and further tasks will be * queued. @@ -4020,10 +4040,10 @@ function parallelLimit$1(tasks, limit, callback) { * }); */ var queue$1 = function (worker, concurrency) { - var _worker = wrapAsync$1(worker); - return queue(function (items, cb) { - _worker(items[0], cb); - }, concurrency, 1); + var _worker = wrapAsync(worker); + return queue(function (items, cb) { + _worker(items[0], cb); + }, concurrency, 1); }; /** @@ -4049,12 +4069,12 @@ var queue$1 = function (worker, concurrency) { * array of `tasks` is given, all tasks will be assigned the same priority. * * The `unshift` method was removed. */ -var priorityQueue = function (worker, concurrency) { +var priorityQueue = function(worker, concurrency) { // Start with a normal queue var q = queue$1(worker, concurrency); // Override push to accept second parameter representing priority - q.push = function (data, priority, callback) { + q.push = function(data, priority, callback) { if (callback == null) callback = noop; if (typeof callback !== 'function') { throw new Error('task callback must be a function'); @@ -4065,7 +4085,7 @@ var priorityQueue = function (worker, concurrency) { } if (data.length === 0) { // call drain immediately if there are no tasks - return setImmediate$1(function () { + return setImmediate$1(function() { q.drain(); }); } @@ -4139,12 +4159,10 @@ function race(tasks, callback) { if (!isArray(tasks)) return callback(new TypeError('First argument to race must be an array of functions')); if (!tasks.length) return callback(); for (var i = 0, l = tasks.length; i < l; i++) { - wrapAsync$1(tasks[i])(callback); + wrapAsync(tasks[i])(callback); } } -var slice = Array.prototype.slice; - /** * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order. * @@ -4167,9 +4185,9 @@ var slice = Array.prototype.slice; * `iteratee` functions have finished. Result is the reduced value. Invoked with * (err, result). */ -function reduceRight(array, memo, iteratee, callback) { - var reversed = slice.call(array).reverse(); - reduce(reversed, memo, iteratee, callback); +function reduceRight (array, memo, iteratee, callback) { + var reversed = slice(array).reverse(); + reduce(reversed, memo, iteratee, callback); } /** @@ -4212,33 +4230,29 @@ function reduceRight(array, memo, iteratee, callback) { * }); */ function reflect(fn) { - var _fn = wrapAsync$1(fn); + var _fn = wrapAsync(fn); return initialParams(function reflectOn(args, reflectCallback) { - args.push(rest(function callback(err, cbArgs) { - if (err) { - reflectCallback(null, { - error: err - }); + args.push(function callback(error, cbArg) { + if (error) { + reflectCallback(null, { error: error }); } else { - var value = null; - if (cbArgs.length === 1) { - value = cbArgs[0]; - } else if (cbArgs.length > 1) { - value = cbArgs; + var value; + if (arguments.length <= 2) { + value = cbArg; + } else { + value = slice(arguments, 1); } - reflectCallback(null, { - value: value - }); + reflectCallback(null, { value: value }); } - })); + }); return _fn.apply(this, args); }); } function reject$1(eachfn, arr, iteratee, callback) { - _filter(eachfn, arr, function (value, cb) { - iteratee(value, function (err, v) { + _filter(eachfn, arr, function(value, cb) { + iteratee(value, function(err, v) { cb(err, !v); }); }, callback); @@ -4346,7 +4360,7 @@ function reflectAll(tasks) { results = arrayMap(tasks, reflect); } else { results = {}; - baseForOwn(tasks, function (task, key) { + baseForOwn(tasks, function(task, key) { results[key] = reflect.call(this, task); }); } @@ -4515,7 +4529,9 @@ function retry(opts, task, callback) { if (typeof t === 'object') { acc.times = +t.times || DEFAULT_TIMES; - acc.intervalFunc = typeof t.interval === 'function' ? t.interval : constant$1(+t.interval || DEFAULT_INTERVAL); + acc.intervalFunc = typeof t.interval === 'function' ? + t.interval : + constant$1(+t.interval || DEFAULT_INTERVAL); acc.errorFilter = t.errorFilter; } else if (typeof t === 'number' || typeof t === 'string') { @@ -4537,12 +4553,14 @@ function retry(opts, task, callback) { throw new Error("Invalid arguments for async.retry"); } - var _task = wrapAsync$1(task); + var _task = wrapAsync(task); var attempt = 1; function retryAttempt() { - _task(function (err) { - if (err && attempt++ < options.times && (typeof options.errorFilter != 'function' || options.errorFilter(err))) { + _task(function(err) { + if (err && attempt++ < options.times && + (typeof options.errorFilter != 'function' || + options.errorFilter(err))) { setTimeout(retryAttempt, options.intervalFunc(attempt)); } else { callback.apply(null, arguments); @@ -4586,13 +4604,15 @@ var retryable = function (opts, task) { task = opts; opts = null; } - var _task = wrapAsync$1(task); + var _task = wrapAsync(task); return initialParams(function (args, callback) { function taskFn(cb) { _task.apply(null, args.concat(cb)); } - if (opts) retry(opts, taskFn, callback);else retry(taskFn, callback); + if (opts) retry(opts, taskFn, callback); + else retry(taskFn, callback); + }); }; @@ -4661,7 +4681,7 @@ var retryable = function (opts, task) { * }); */ function series(tasks, callback) { - _parallel(eachOfSeries, tasks, callback); + _parallel(eachOfSeries, tasks, callback); } /** @@ -4788,12 +4808,12 @@ var someSeries = doLimit(someLimit, 1); * // result callback * }); */ -function sortBy(coll, iteratee, callback) { - var _iteratee = wrapAsync$1(iteratee); +function sortBy (coll, iteratee, callback) { + var _iteratee = wrapAsync(iteratee); map(coll, function (x, callback) { _iteratee(x, function (err, criteria) { if (err) return callback(err); - callback(null, { value: x, criteria: criteria }); + callback(null, {value: x, criteria: criteria}); }); }, function (err, results) { if (err) return callback(err); @@ -4801,8 +4821,7 @@ function sortBy(coll, iteratee, callback) { }); function comparator(left, right) { - var a = left.criteria, - b = right.criteria; + var a = left.criteria, b = right.criteria; return a < b ? -1 : a > b ? 1 : 0; } } @@ -4849,40 +4868,39 @@ function sortBy(coll, iteratee, callback) { * }); */ function timeout(asyncFn, milliseconds, info) { - var originalCallback, timer; - var timedOut = false; - - function injectedCallback() { - if (!timedOut) { - originalCallback.apply(null, arguments); - clearTimeout(timer); - } - } + var fn = wrapAsync(asyncFn); - function timeoutCallback() { - var name = asyncFn.name || 'anonymous'; - var error = new Error('Callback function "' + name + '" timed out.'); - error.code = 'ETIMEDOUT'; - if (info) { - error.info = info; + return initialParams(function (args, callback) { + var timedOut = false; + var timer; + + function timeoutCallback() { + var name = asyncFn.name || 'anonymous'; + var error = new Error('Callback function "' + name + '" timed out.'); + error.code = 'ETIMEDOUT'; + if (info) { + error.info = info; + } + timedOut = true; + callback(error); } - timedOut = true; - originalCallback(error); - } - var fn = wrapAsync$1(asyncFn); + args.push(function () { + if (!timedOut) { + callback.apply(null, arguments); + clearTimeout(timer); + } + }); - return initialParams(function (args, origCallback) { - originalCallback = origCallback; // setup timer and call original function timer = setTimeout(timeoutCallback, milliseconds); - fn.apply(null, args.concat(injectedCallback)); + fn.apply(null, args); }); } /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeCeil = Math.ceil; -var nativeMax$1 = Math.max; +var nativeMax = Math.max; /** * The base implementation of `_.range` and `_.rangeRight` which doesn't @@ -4897,7 +4915,7 @@ var nativeMax$1 = Math.max; */ function baseRange(start, end, step, fromRight) { var index = -1, - length = nativeMax$1(nativeCeil((end - start) / (step || 1)), 0), + length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result = Array(length); while (length--) { @@ -4924,8 +4942,8 @@ function baseRange(start, end, step, fromRight) { * @param {Function} callback - see [async.map]{@link module:Collections.map}. */ function timeLimit(count, limit, iteratee, callback) { - var _iteratee = wrapAsync$1(iteratee); - mapLimit(baseRange(0, count, 1), limit, _iteratee, callback); + var _iteratee = wrapAsync(iteratee); + mapLimit(baseRange(0, count, 1), limit, _iteratee, callback); } /** @@ -5020,23 +5038,79 @@ var timesSeries = doLimit(timeLimit, 1); * // result is equal to {a: 2, b: 4, c: 6} * }) */ -function transform(coll, accumulator, iteratee, callback) { +function transform (coll, accumulator, iteratee, callback) { if (arguments.length <= 3) { callback = iteratee; iteratee = accumulator; accumulator = isArray(coll) ? [] : {}; } callback = once(callback || noop); - var _iteratee = wrapAsync$1(iteratee); + var _iteratee = wrapAsync(iteratee); - eachOf(coll, function (v, k, cb) { + eachOf(coll, function(v, k, cb) { _iteratee(accumulator, v, k, cb); - }, function (err) { + }, function(err) { callback(err, accumulator); }); } /** + * It runs each task in series but stops whenever any of the functions were + * successful. If one of the tasks were successful, the `callback` will be + * passed the result of the successful task. If all tasks fail, the callback + * will be passed the error and result (if any) of the final attempt. + * + * @name tryEach + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Array|Iterable|Object} tasks - A collection containing functions to + * run, each function is passed a `callback(err, result)` it must call on + * completion with an error `err` (which can be `null`) and an optional `result` + * value. + * @param {Function} [callback] - An optional callback which is called when one + * of the tasks has succeeded, or all have failed. It receives the `err` and + * `result` arguments of the last attempt at completing the `task`. Invoked with + * (err, results). + * @example + * async.try([ + * function getDataFromFirstWebsite(callback) { + * // Try getting the data from the first website + * callback(err, data); + * }, + * function getDataFromSecondWebsite(callback) { + * // First website failed, + * // Try getting the data from the backup website + * callback(err, data); + * } + * ], + * // optional callback + * function(err, results) { + * Now do something with the data. + * }); + * + */ +function tryEach(tasks, callback) { + var error = null; + var result; + callback = callback || noop; + eachSeries(tasks, function(task, callback) { + wrapAsync(task)(function (err, res/*, ...args*/) { + if (arguments.length > 2) { + result = slice(arguments, 1); + } else { + result = res; + } + error = err; + callback(!err); + }); + }, function () { + callback(error, result); + }); +} + +/** * Undoes a [memoize]{@link module:Utils.memoize}d function, reverting it to the original, * unmemoized form. Handy for testing. * @@ -5091,13 +5165,14 @@ function unmemoize(fn) { */ function whilst(test, iteratee, callback) { callback = onlyOnce(callback || noop); - var _iteratee = wrapAsync$1(iteratee); + var _iteratee = wrapAsync(iteratee); if (!test()) return callback(null); - var next = rest(function (err, args) { + var next = function(err/*, ...args*/) { if (err) return callback(err); if (test()) return _iteratee(next); + var args = slice(arguments, 1); callback.apply(null, [null].concat(args)); - }); + }; _iteratee(next); } @@ -5124,7 +5199,7 @@ function whilst(test, iteratee, callback) { * callback. Invoked with (err, [results]); */ function until(test, iteratee, callback) { - whilst(function () { + whilst(function() { return !test.apply(this, arguments); }, iteratee, callback); } @@ -5186,30 +5261,25 @@ function until(test, iteratee, callback) { * callback(null, 'done'); * } */ -var waterfall = function (tasks, callback) { +var waterfall = function(tasks, callback) { callback = once(callback || noop); if (!isArray(tasks)) return callback(new Error('First argument to waterfall must be an array of functions')); if (!tasks.length) return callback(); var taskIndex = 0; function nextTask(args) { - if (taskIndex === tasks.length) { - return callback.apply(null, [null].concat(args)); - } - - var taskCallback = onlyOnce(rest(function (err, args) { - if (err) { - return callback.apply(null, [err].concat(args)); - } - nextTask(args); - })); - - args.push(taskCallback); - - var task = wrapAsync$1(tasks[taskIndex++]); + var task = wrapAsync(tasks[taskIndex++]); + args.push(onlyOnce(next)); task.apply(null, args); } + function next(err/*, ...args*/) { + if (err || taskIndex === tasks.length) { + return callback.apply(null, arguments); + } + nextTask(slice(arguments, 1)); + } + nextTask([]); }; @@ -5261,6 +5331,7 @@ var waterfall = function (tasks, callback) { * @see AsyncFunction */ + /** * A collection of `async` functions for manipulating collections, such as * arrays and objects. @@ -5278,104 +5349,105 @@ var waterfall = function (tasks, callback) { */ var index = { - applyEach: applyEach, - applyEachSeries: applyEachSeries, - apply: apply$2, - asyncify: asyncify, - auto: auto, - autoInject: autoInject, - cargo: cargo, - compose: compose, - concat: concat, - concatSeries: concatSeries, - constant: constant, - detect: detect, - detectLimit: detectLimit, - detectSeries: detectSeries, - dir: dir, - doDuring: doDuring, - doUntil: doUntil, - doWhilst: doWhilst, - during: during, - each: eachLimit, - eachLimit: eachLimit$1, - eachOf: eachOf, - eachOfLimit: eachOfLimit, - eachOfSeries: eachOfSeries, - eachSeries: eachSeries, - ensureAsync: ensureAsync, - every: every, - everyLimit: everyLimit, - everySeries: everySeries, - filter: filter, - filterLimit: filterLimit, - filterSeries: filterSeries, - forever: forever, - groupBy: groupBy, - groupByLimit: groupByLimit, - groupBySeries: groupBySeries, - log: log, - map: map, - mapLimit: mapLimit, - mapSeries: mapSeries, - mapValues: mapValues, - mapValuesLimit: mapValuesLimit, - mapValuesSeries: mapValuesSeries, - memoize: memoize, - nextTick: nextTick, - parallel: parallelLimit, - parallelLimit: parallelLimit$1, - priorityQueue: priorityQueue, - queue: queue$1, - race: race, - reduce: reduce, - reduceRight: reduceRight, - reflect: reflect, - reflectAll: reflectAll, - reject: reject, - rejectLimit: rejectLimit, - rejectSeries: rejectSeries, - retry: retry, - retryable: retryable, - seq: seq$1, - series: series, - setImmediate: setImmediate$1, - some: some, - someLimit: someLimit, - someSeries: someSeries, - sortBy: sortBy, - timeout: timeout, - times: times, - timesLimit: timeLimit, - timesSeries: timesSeries, - transform: transform, - unmemoize: unmemoize, - until: until, - waterfall: waterfall, - whilst: whilst, - - // aliases - all: every, - any: some, - forEach: eachLimit, - forEachSeries: eachSeries, - forEachLimit: eachLimit$1, - forEachOf: eachOf, - forEachOfSeries: eachOfSeries, - forEachOfLimit: eachOfLimit, - inject: reduce, - foldl: reduce, - foldr: reduceRight, - select: filter, - selectLimit: filterLimit, - selectSeries: filterSeries, - wrapSync: asyncify + applyEach: applyEach, + applyEachSeries: applyEachSeries, + apply: apply, + asyncify: asyncify, + auto: auto, + autoInject: autoInject, + cargo: cargo, + compose: compose, + concat: concat, + concatSeries: concatSeries, + constant: constant, + detect: detect, + detectLimit: detectLimit, + detectSeries: detectSeries, + dir: dir, + doDuring: doDuring, + doUntil: doUntil, + doWhilst: doWhilst, + during: during, + each: eachLimit, + eachLimit: eachLimit$1, + eachOf: eachOf, + eachOfLimit: eachOfLimit, + eachOfSeries: eachOfSeries, + eachSeries: eachSeries, + ensureAsync: ensureAsync, + every: every, + everyLimit: everyLimit, + everySeries: everySeries, + filter: filter, + filterLimit: filterLimit, + filterSeries: filterSeries, + forever: forever, + groupBy: groupBy, + groupByLimit: groupByLimit, + groupBySeries: groupBySeries, + log: log, + map: map, + mapLimit: mapLimit, + mapSeries: mapSeries, + mapValues: mapValues, + mapValuesLimit: mapValuesLimit, + mapValuesSeries: mapValuesSeries, + memoize: memoize, + nextTick: nextTick, + parallel: parallelLimit, + parallelLimit: parallelLimit$1, + priorityQueue: priorityQueue, + queue: queue$1, + race: race, + reduce: reduce, + reduceRight: reduceRight, + reflect: reflect, + reflectAll: reflectAll, + reject: reject, + rejectLimit: rejectLimit, + rejectSeries: rejectSeries, + retry: retry, + retryable: retryable, + seq: seq, + series: series, + setImmediate: setImmediate$1, + some: some, + someLimit: someLimit, + someSeries: someSeries, + sortBy: sortBy, + timeout: timeout, + times: times, + timesLimit: timeLimit, + timesSeries: timesSeries, + transform: transform, + tryEach: tryEach, + unmemoize: unmemoize, + until: until, + waterfall: waterfall, + whilst: whilst, + + // aliases + all: every, + any: some, + forEach: eachLimit, + forEachSeries: eachSeries, + forEachLimit: eachLimit$1, + forEachOf: eachOf, + forEachOfSeries: eachOfSeries, + forEachOfLimit: eachOfLimit, + inject: reduce, + foldl: reduce, + foldr: reduceRight, + select: filter, + selectLimit: filterLimit, + selectSeries: filterSeries, + wrapSync: asyncify }; exports['default'] = index; exports.applyEach = applyEach; exports.applyEachSeries = applyEachSeries; -exports.apply = apply$2; +exports.apply = apply; exports.asyncify = asyncify; exports.auto = auto; exports.autoInject = autoInject; @@ -5432,7 +5504,7 @@ exports.rejectLimit = rejectLimit; exports.rejectSeries = rejectSeries; exports.retry = retry; exports.retryable = retryable; -exports.seq = seq$1; +exports.seq = seq; exports.series = series; exports.setImmediate = setImmediate$1; exports.some = some; @@ -5444,6 +5516,7 @@ exports.times = times; exports.timesLimit = timeLimit; exports.timesSeries = timesSeries; exports.transform = transform; +exports.tryEach = tryEach; exports.unmemoize = unmemoize; exports.until = until; exports.waterfall = waterfall; diff --git a/node_modules/async/dist/async.min.js b/node_modules/async/dist/async.min.js index afd1022c1..61e48cb10 100644 --- a/node_modules/async/dist/async.min.js +++ b/node_modules/async/dist/async.min.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.async=e.async||{})}(this,function(exports){"use strict";function apply(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function overRest$1(e,t,r){return t=nativeMax(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,i=nativeMax(n.length-t,0),a=Array(i);++o<i;)a[o]=n[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=n[o];return s[t]=r(a),apply(e,this,s)}}function identity(e){return e}function rest(e,t){return overRest$1(e,t,identity)}function isObject(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function asyncify(e){return initialParams(function(t,r){var n;try{n=e.apply(this,t)}catch(e){return r(e)}isObject(n)&&"function"==typeof n.then?n.then(function(e){r(null,e)},function(e){r(e.message?e:new Error(e))}):r(null,n)})}function supportsAsync(){var supported;try{supported=isAsync(eval("(async function () {})"))}catch(e){supported=!1}return supported}function isAsync(e){return supportsSymbol&&"AsyncFunction"===e[Symbol.toStringTag]}function wrapAsync(e){return isAsync(e)?asyncify(e):e}function applyEach$1(e){return rest(function(t,r){var n=initialParams(function(r,n){var o=this;return e(t,function(e,t){wrapAsync$1(e).apply(o,r.concat(t))},n)});return r.length?n.apply(this,r):n})}function getRawTag(e){var t=hasOwnProperty.call(e,symToStringTag$1),r=e[symToStringTag$1];try{e[symToStringTag$1]=void 0;var n=!0}catch(e){}var o=nativeObjectToString.call(e);return n&&(t?e[symToStringTag$1]=r:delete e[symToStringTag$1]),o}function objectToString(e){return nativeObjectToString$1.call(e)}function baseGetTag(e){return null==e?void 0===e?undefinedTag:nullTag:(e=Object(e),symToStringTag&&symToStringTag in e?getRawTag(e):objectToString(e))}function isFunction(e){if(!isObject(e))return!1;var t=baseGetTag(e);return t==funcTag||t==genTag||t==asyncTag||t==proxyTag}function isLength(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=MAX_SAFE_INTEGER}function isArrayLike(e){return null!=e&&isLength(e.length)&&!isFunction(e)}function noop(){}function once(e){return function(){if(null!==e){var t=e;e=null,t.apply(this,arguments)}}}function baseTimes(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function isObjectLike(e){return null!=e&&"object"==typeof e}function baseIsArguments(e){return isObjectLike(e)&&baseGetTag(e)==argsTag}function stubFalse(){return!1}function isIndex(e,t){return t=null==t?MAX_SAFE_INTEGER$1:t,!!t&&("number"==typeof e||reIsUint.test(e))&&e>-1&&e%1==0&&e<t}function baseIsTypedArray(e){return isObjectLike(e)&&isLength(e.length)&&!!typedArrayTags[baseGetTag(e)]}function baseUnary(e){return function(t){return e(t)}}function arrayLikeKeys(e,t){var r=isArray(e),n=!r&&isArguments(e),o=!r&&!n&&isBuffer(e),i=!r&&!n&&!o&&isTypedArray(e),a=r||n||o||i,s=a?baseTimes(e.length,String):[],c=s.length;for(var u in e)!t&&!hasOwnProperty$1.call(e,u)||a&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||isIndex(u,c))||s.push(u);return s}function isPrototype(e){var t=e&&e.constructor,r="function"==typeof t&&t.prototype||objectProto$5;return e===r}function overArg(e,t){return function(r){return e(t(r))}}function baseKeys(e){if(!isPrototype(e))return nativeKeys(e);var t=[];for(var r in Object(e))hasOwnProperty$3.call(e,r)&&"constructor"!=r&&t.push(r);return t}function keys(e){return isArrayLike(e)?arrayLikeKeys(e):baseKeys(e)}function createArrayIterator(e){var t=-1,r=e.length;return function(){return++t<r?{value:e[t],key:t}:null}}function createES2015Iterator(e){var t=-1;return function(){var r=e.next();return r.done?null:(t++,{value:r.value,key:t})}}function createObjectIterator(e){var t=keys(e),r=-1,n=t.length;return function(){var o=t[++r];return r<n?{value:e[o],key:o}:null}}function iterator(e){if(isArrayLike(e))return createArrayIterator(e);var t=getIterator(e);return t?createES2015Iterator(t):createObjectIterator(e)}function onlyOnce(e){return function(){if(null===e)throw new Error("Callback was already called.");var t=e;e=null,t.apply(this,arguments)}}function _eachOfLimit(e){return function(t,r,n){function o(e,t){if(c-=1,e)s=!0,n(e);else{if(t===breakLoop||s&&c<=0)return s=!0,n(null);i()}}function i(){for(;c<e&&!s;){var t=a();if(null===t)return s=!0,void(c<=0&&n(null));c+=1,r(t.value,t.key,onlyOnce(o))}}if(n=once(n||noop),e<=0||!t)return n(null);var a=iterator(t),s=!1,c=0;i()}}function eachOfLimit(e,t,r,n){_eachOfLimit(t)(e,wrapAsync$1(r),n)}function doLimit(e,t){return function(r,n,o){return e(r,t,n,o)}}function eachOfArrayLike(e,t,r){function n(e,t){e?r(e):++i!==a&&t!==breakLoop||r(null)}r=once(r||noop);var o=0,i=0,a=e.length;for(0===a&&r(null);o<a;o++)t(e[o],o,onlyOnce(n))}function doParallel(e){return function(t,r,n){return e(eachOf,t,wrapAsync$1(r),n)}}function _asyncMap(e,t,r,n){n=n||noop,t=t||[];var o=[],i=0,a=wrapAsync$1(r);e(t,function(e,t,r){var n=i++;a(e,function(e,t){o[n]=t,r(e)})},function(e){n(e,o)})}function doParallelLimit(e){return function(t,r,n,o){return e(_eachOfLimit(r),t,wrapAsync$1(n),o)}}function arrayEach(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}function createBaseFor(e){return function(t,r,n){for(var o=-1,i=Object(t),a=n(t),s=a.length;s--;){var c=a[e?s:++o];if(r(i[c],c,i)===!1)break}return t}}function baseForOwn(e,t){return e&&baseFor(e,t,keys)}function baseFindIndex(e,t,r,n){for(var o=e.length,i=r+(n?1:-1);n?i--:++i<o;)if(t(e[i],i,e))return i;return-1}function baseIsNaN(e){return e!==e}function strictIndexOf(e,t,r){for(var n=r-1,o=e.length;++n<o;)if(e[n]===t)return n;return-1}function baseIndexOf(e,t,r){return t===t?strictIndexOf(e,t,r):baseFindIndex(e,baseIsNaN,r)}function arrayMap(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o}function isSymbol(e){return"symbol"==typeof e||isObjectLike(e)&&baseGetTag(e)==symbolTag}function baseToString(e){if("string"==typeof e)return e;if(isArray(e))return arrayMap(e,baseToString)+"";if(isSymbol(e))return symbolToString?symbolToString.call(e):"";var t=e+"";return"0"==t&&1/e==-INFINITY?"-0":t}function baseSlice(e,t,r){var n=-1,o=e.length;t<0&&(t=-t>o?0:o+t),r=r>o?o:r,r<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(o);++n<o;)i[n]=e[n+t];return i}function castSlice(e,t,r){var n=e.length;return r=void 0===r?n:r,!t&&r>=n?e:baseSlice(e,t,r)}function charsEndIndex(e,t){for(var r=e.length;r--&&baseIndexOf(t,e[r],0)>-1;);return r}function charsStartIndex(e,t){for(var r=-1,n=e.length;++r<n&&baseIndexOf(t,e[r],0)>-1;);return r}function asciiToArray(e){return e.split("")}function hasUnicode(e){return reHasUnicode.test(e)}function unicodeToArray(e){return e.match(reUnicode)||[]}function stringToArray(e){return hasUnicode(e)?unicodeToArray(e):asciiToArray(e)}function toString(e){return null==e?"":baseToString(e)}function trim(e,t,r){if(e=toString(e),e&&(r||void 0===t))return e.replace(reTrim,"");if(!e||!(t=baseToString(t)))return e;var n=stringToArray(e),o=stringToArray(t),i=charsStartIndex(n,o),a=charsEndIndex(n,o)+1;return castSlice(n,i,a).join("")}function parseParams(e){return e=e.toString().replace(STRIP_COMMENTS,""),e=e.match(FN_ARGS)[2].replace(" ",""),e=e?e.split(FN_ARG_SPLIT):[],e=e.map(function(e){return trim(e.replace(FN_ARG,""))})}function autoInject(e,t){var r={};baseForOwn(e,function(e,t){function n(t,r){var n=arrayMap(o,function(e){return t[e]});n.push(r),wrapAsync$1(e).apply(null,n)}var o,i=isAsync(e),a=!i&&1===e.length||i&&0===e.length;if(isArray(e))o=e.slice(0,-1),e=e[e.length-1],r[t]=o.concat(o.length>0?n:e);else if(a)r[t]=e;else{if(o=parseParams(e),0===e.length&&!i&&0===o.length)throw new Error("autoInject task functions require explicit parameters.");i||o.pop(),r[t]=o.concat(n)}}),auto(r,t)}function fallback(e){setTimeout(e,0)}function wrap(e){return rest(function(t,r){e(function(){t.apply(null,r)})})}function DLL(){this.head=this.tail=null,this.length=0}function setInitial(e,t){e.length=1,e.head=e.tail=t}function queue(e,t,r){function n(e,t,r){if(null!=r&&"function"!=typeof r)throw new Error("task callback must be a function");if(u.started=!0,isArray(e)||(e=[e]),0===e.length&&u.idle())return setImmediate$1(function(){u.drain()});for(var n=0,o=e.length;n<o;n++){var i={data:e[n],callback:r||noop};t?u._tasks.unshift(i):u._tasks.push(i)}setImmediate$1(u.process)}function o(e){return rest(function(t){a-=1;for(var r=0,n=e.length;r<n;r++){var o=e[r],i=baseIndexOf(s,o,0);i>=0&&s.splice(i),o.callback.apply(o,t),null!=t[0]&&u.error(t[0],o.data)}a<=u.concurrency-u.buffer&&u.unsaturated(),u.idle()&&u.drain(),u.process()})}if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var i=wrapAsync$1(e),a=0,s=[],c=!1,u={_tasks:new DLL,concurrency:t,payload:r,saturated:noop,unsaturated:noop,buffer:t/4,empty:noop,drain:noop,error:noop,started:!1,paused:!1,push:function(e,t){n(e,!1,t)},kill:function(){u.drain=noop,u._tasks.empty()},unshift:function(e,t){n(e,!0,t)},process:function(){if(!c){for(c=!0;!u.paused&&a<u.concurrency&&u._tasks.length;){var e=[],t=[],r=u._tasks.length;u.payload&&(r=Math.min(r,u.payload));for(var n=0;n<r;n++){var l=u._tasks.shift();e.push(l),t.push(l.data)}0===u._tasks.length&&u.empty(),a+=1,s.push(e[0]),a===u.concurrency&&u.saturated();var f=onlyOnce(o(e));i(t,f)}c=!1}},length:function(){return u._tasks.length},running:function(){return a},workersList:function(){return s},idle:function(){return u._tasks.length+a===0},pause:function(){u.paused=!0},resume:function(){u.paused!==!1&&(u.paused=!1,setImmediate$1(u.process))}};return u}function cargo(e,t){return queue(e,1,t)}function reduce(e,t,r,n){n=once(n||noop);var o=wrapAsync$1(r);eachOfSeries(e,function(e,r,n){o(t,e,function(e,r){t=r,n(e)})},function(e){n(e,t)})}function concat$1(e,t,r,n){var o=[];e(t,function(e,t,n){r(e,function(e,t){o=o.concat(t||[]),n(e)})},function(e){n(e,o)})}function doSeries(e){return function(t,r,n){return e(eachOfSeries,t,wrapAsync$1(r),n)}}function _createTester(e,t){return function(r,n,o,i){i=i||noop;var a,s=!1;r(n,function(r,n,i){o(r,function(n,o){n?i(n):e(o)&&!a?(s=!0,a=t(!0,r),i(null,breakLoop)):i()})},function(e){e?i(e):i(null,s?a:t(!1))})}}function _findGetResult(e,t){return t}function consoleFunc(e){return rest(function(t,r){wrapAsync$1(t).apply(null,r.concat(rest(function(t,r){"object"==typeof console&&(t?console.error&&console.error(t):console[e]&&arrayEach(r,function(t){console[e](t)}))})))})}function doDuring(e,t,r){function n(e,t){return e?r(e):t?void o(a):r(null)}r=onlyOnce(r||noop);var o=wrapAsync$1(e),i=wrapAsync$1(t),a=rest(function(e,t){return e?r(e):(t.push(n),void i.apply(this,t))});n(null,!0)}function doWhilst(e,t,r){r=onlyOnce(r||noop);var n=wrapAsync$1(e),o=rest(function(e,i){return e?r(e):t.apply(this,i)?n(o):void r.apply(null,[null].concat(i))});n(o)}function doUntil(e,t,r){doWhilst(e,function(){return!t.apply(this,arguments)},r)}function during(e,t,r){function n(e){return e?r(e):void a(o)}function o(e,t){return e?r(e):t?void i(n):r(null)}r=onlyOnce(r||noop);var i=wrapAsync$1(t),a=wrapAsync$1(e);a(o)}function _withoutIndex(e){return function(t,r,n){return e(t,n)}}function eachLimit(e,t,r){eachOf(e,_withoutIndex(wrapAsync$1(t)),r)}function eachLimit$1(e,t,r,n){_eachOfLimit(t)(e,_withoutIndex(wrapAsync$1(r)),n)}function ensureAsync(e){return isAsync(e)?e:initialParams(function(t,r){var n=!0;t.push(function(){var e=arguments;n?setImmediate$1(function(){r.apply(null,e)}):r.apply(null,e)}),e.apply(this,t),n=!1})}function notId(e){return!e}function baseProperty(e){return function(t){return null==t?void 0:t[e]}}function filterArray(e,t,r,n){var o=new Array(t.length);e(t,function(e,t,n){r(e,function(e,r){o[t]=!!r,n(e)})},function(e){if(e)return n(e);for(var r=[],i=0;i<t.length;i++)o[i]&&r.push(t[i]);n(null,r)})}function filterGeneric(e,t,r,n){var o=[];e(t,function(e,t,n){r(e,function(r,i){r?n(r):(i&&o.push({index:t,value:e}),n())})},function(e){e?n(e):n(null,arrayMap(o.sort(function(e,t){return e.index-t.index}),baseProperty("value")))})}function _filter(e,t,r,n){var o=isArrayLike(t)?filterArray:filterGeneric;o(e,t,wrapAsync$1(r),n||noop)}function forever(e,t){function r(e){return e?n(e):void o(r)}var n=onlyOnce(t||noop),o=wrapAsync$1(ensureAsync(e));r()}function mapValuesLimit(e,t,r,n){n=once(n||noop);var o={},i=wrapAsync$1(r);eachOfLimit(e,t,function(e,t,r){i(e,t,function(e,n){return e?r(e):(o[t]=n,void r())})},function(e){n(e,o)})}function has(e,t){return t in e}function memoize(e,t){var r=Object.create(null),n=Object.create(null);t=t||identity;var o=wrapAsync$1(e),i=initialParams(function(e,i){var a=t.apply(null,e);has(r,a)?setImmediate$1(function(){i.apply(null,r[a])}):has(n,a)?n[a].push(i):(n[a]=[i],o.apply(null,e.concat(rest(function(e){r[a]=e;var t=n[a];delete n[a];for(var o=0,i=t.length;o<i;o++)t[o].apply(null,e)}))))});return i.memo=r,i.unmemoized=e,i}function _parallel(e,t,r){r=r||noop;var n=isArrayLike(t)?[]:{};e(t,function(e,t,r){wrapAsync$1(e)(rest(function(e,o){o.length<=1&&(o=o[0]),n[t]=o,r(e)}))},function(e){r(e,n)})}function parallelLimit(e,t){_parallel(eachOf,e,t)}function parallelLimit$1(e,t,r){_parallel(_eachOfLimit(t),e,r)}function race(e,t){if(t=once(t||noop),!isArray(e))return t(new TypeError("First argument to race must be an array of functions"));if(!e.length)return t();for(var r=0,n=e.length;r<n;r++)wrapAsync$1(e[r])(t)}function reduceRight(e,t,r,n){var o=slice.call(e).reverse();reduce(o,t,r,n)}function reflect(e){var t=wrapAsync$1(e);return initialParams(function(e,r){return e.push(rest(function(e,t){if(e)r(null,{error:e});else{var n=null;1===t.length?n=t[0]:t.length>1&&(n=t),r(null,{value:n})}})),t.apply(this,e)})}function reject$1(e,t,r,n){_filter(e,t,function(e,t){r(e,function(e,r){t(e,!r)})},n)}function reflectAll(e){var t;return isArray(e)?t=arrayMap(e,reflect):(t={},baseForOwn(e,function(e,r){t[r]=reflect.call(this,e)})),t}function constant$1(e){return function(){return e}}function retry(e,t,r){function n(e,t){if("object"==typeof t)e.times=+t.times||i,e.intervalFunc="function"==typeof t.interval?t.interval:constant$1(+t.interval||a),e.errorFilter=t.errorFilter;else{if("number"!=typeof t&&"string"!=typeof t)throw new Error("Invalid arguments for async.retry");e.times=+t||i}}function o(){c(function(e){e&&u++<s.times&&("function"!=typeof s.errorFilter||s.errorFilter(e))?setTimeout(o,s.intervalFunc(u)):r.apply(null,arguments)})}var i=5,a=0,s={times:i,intervalFunc:constant$1(a)};if(arguments.length<3&&"function"==typeof e?(r=t||noop,t=e):(n(s,e),r=r||noop),"function"!=typeof t)throw new Error("Invalid arguments for async.retry");var c=wrapAsync$1(t),u=1;o()}function series(e,t){_parallel(eachOfSeries,e,t)}function sortBy(e,t,r){function n(e,t){var r=e.criteria,n=t.criteria;return r<n?-1:r>n?1:0}var o=wrapAsync$1(t);map(e,function(e,t){o(e,function(r,n){return r?t(r):void t(null,{value:e,criteria:n})})},function(e,t){return e?r(e):void r(null,arrayMap(t.sort(n),baseProperty("value")))})}function timeout(e,t,r){function n(){s||(i.apply(null,arguments),clearTimeout(a))}function o(){var t=e.name||"anonymous",n=new Error('Callback function "'+t+'" timed out.');n.code="ETIMEDOUT",r&&(n.info=r),s=!0,i(n)}var i,a,s=!1,c=wrapAsync$1(e);return initialParams(function(e,r){i=r,a=setTimeout(o,t),c.apply(null,e.concat(n))})}function baseRange(e,t,r,n){for(var o=-1,i=nativeMax$1(nativeCeil((t-e)/(r||1)),0),a=Array(i);i--;)a[n?i:++o]=e,e+=r;return a}function timeLimit(e,t,r,n){var o=wrapAsync$1(r);mapLimit(baseRange(0,e,1),t,o,n)}function transform(e,t,r,n){arguments.length<=3&&(n=r,r=t,t=isArray(e)?[]:{}),n=once(n||noop);var o=wrapAsync$1(r);eachOf(e,function(e,r,n){o(t,e,r,n)},function(e){n(e,t)})}function unmemoize(e){return function(){return(e.unmemoized||e).apply(null,arguments)}}function whilst(e,t,r){r=onlyOnce(r||noop);var n=wrapAsync$1(t);if(!e())return r(null);var o=rest(function(t,i){return t?r(t):e()?n(o):void r.apply(null,[null].concat(i))});n(o)}function until(e,t,r){whilst(function(){return!e.apply(this,arguments)},t,r)}var nativeMax=Math.max,initialParams=function(e){return rest(function(t){var r=t.pop();e.call(this,t,r)})},supportsSymbol="function"==typeof Symbol,wrapAsync$1=supportsAsync()?wrapAsync:identity,freeGlobal="object"==typeof global&&global&&global.Object===Object&&global,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),Symbol$1=root.Symbol,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,nativeObjectToString=objectProto.toString,symToStringTag$1=Symbol$1?Symbol$1.toStringTag:void 0,objectProto$1=Object.prototype,nativeObjectToString$1=objectProto$1.toString,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol$1?Symbol$1.toStringTag:void 0,asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]",MAX_SAFE_INTEGER=9007199254740991,breakLoop={},iteratorSymbol="function"==typeof Symbol&&Symbol.iterator,getIterator=function(e){return iteratorSymbol&&e[iteratorSymbol]&&e[iteratorSymbol]()},argsTag="[object Arguments]",objectProto$3=Object.prototype,hasOwnProperty$2=objectProto$3.hasOwnProperty,propertyIsEnumerable=objectProto$3.propertyIsEnumerable,isArguments=baseIsArguments(function(){return arguments}())?baseIsArguments:function(e){return isObjectLike(e)&&hasOwnProperty$2.call(e,"callee")&&!propertyIsEnumerable.call(e,"callee")},isArray=Array.isArray,freeExports="object"==typeof exports&&exports&&!exports.nodeType&&exports,freeModule=freeExports&&"object"==typeof module&&module&&!module.nodeType&&module,moduleExports=freeModule&&freeModule.exports===freeExports,Buffer=moduleExports?root.Buffer:void 0,nativeIsBuffer=Buffer?Buffer.isBuffer:void 0,isBuffer=nativeIsBuffer||stubFalse,MAX_SAFE_INTEGER$1=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/,argsTag$1="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag$1="[object Function]",mapTag="[object Map]",numberTag="[object Number]",objectTag="[object Object]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",weakMapTag="[object WeakMap]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=!0,typedArrayTags[argsTag$1]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag$1]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=!1;var freeExports$1="object"==typeof exports&&exports&&!exports.nodeType&&exports,freeModule$1=freeExports$1&&"object"==typeof module&&module&&!module.nodeType&&module,moduleExports$1=freeModule$1&&freeModule$1.exports===freeExports$1,freeProcess=moduleExports$1&&freeGlobal.process,nodeUtil=function(){try{return freeProcess&&freeProcess.binding("util")}catch(e){}}(),nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray,objectProto$2=Object.prototype,hasOwnProperty$1=objectProto$2.hasOwnProperty,objectProto$5=Object.prototype,nativeKeys=overArg(Object.keys,Object),objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty,eachOfGeneric=doLimit(eachOfLimit,1/0),eachOf=function(e,t,r){var n=isArrayLike(e)?eachOfArrayLike:eachOfGeneric;n(e,wrapAsync$1(t),r)},map=doParallel(_asyncMap),applyEach=applyEach$1(map),mapLimit=doParallelLimit(_asyncMap),mapSeries=doLimit(mapLimit,1),applyEachSeries=applyEach$1(mapSeries),apply$2=rest(function(e,t){return rest(function(r){return e.apply(null,t.concat(r))})}),baseFor=createBaseFor(),auto=function(e,t,r){function n(e,t){g.push(function(){s(e,t)})}function o(){if(0===g.length&&0===y)return r(null,p);for(;g.length&&y<t;){var e=g.shift();e()}}function i(e,t){var r=d[e];r||(r=d[e]=[]),r.push(t)}function a(e){var t=d[e]||[];arrayEach(t,function(e){e()}),o()}function s(e,t){if(!m){var n=onlyOnce(rest(function(t,n){if(y--,n.length<=1&&(n=n[0]),t){var o={};baseForOwn(p,function(e,t){o[t]=e}),o[e]=n,m=!0,d=Object.create(null),r(t,o)}else p[e]=n,a(e)}));y++;var o=wrapAsync$1(t[t.length-1]);t.length>1?o(p,n):o(n)}}function c(){for(var e,t=0;h.length;)e=h.pop(),t++,arrayEach(u(e),function(e){0===--b[e]&&h.push(e)});if(t!==f)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}function u(t){var r=[];return baseForOwn(e,function(e,n){isArray(e)&&baseIndexOf(e,t,0)>=0&&r.push(n)}),r}"function"==typeof t&&(r=t,t=null),r=once(r||noop);var l=keys(e),f=l.length;if(!f)return r(null);t||(t=f);var p={},y=0,m=!1,d=Object.create(null),g=[],h=[],b={};baseForOwn(e,function(t,r){if(!isArray(t))return n(r,[t]),void h.push(r);var o=t.slice(0,t.length-1),a=o.length;return 0===a?(n(r,t),void h.push(r)):(b[r]=a,void arrayEach(o,function(s){if(!e[s])throw new Error("async.auto task `"+r+"` has a non-existent dependency `"+s+"` in "+o.join(", "));i(s,function(){a--,0===a&&n(r,t)})}))}),c(),o()},symbolTag="[object Symbol]",INFINITY=1/0,symbolProto=Symbol$1?Symbol$1.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0,rsAstralRange="\\ud800-\\udfff",rsComboMarksRange="\\u0300-\\u036f\\ufe20-\\ufe23",rsComboSymbolsRange="\\u20d0-\\u20f0",rsVarRange="\\ufe0e\\ufe0f",rsZWJ="\\u200d",reHasUnicode=RegExp("["+rsZWJ+rsAstralRange+rsComboMarksRange+rsComboSymbolsRange+rsVarRange+"]"),rsAstralRange$1="\\ud800-\\udfff",rsComboMarksRange$1="\\u0300-\\u036f\\ufe20-\\ufe23",rsComboSymbolsRange$1="\\u20d0-\\u20f0",rsVarRange$1="\\ufe0e\\ufe0f",rsAstral="["+rsAstralRange$1+"]",rsCombo="["+rsComboMarksRange$1+rsComboSymbolsRange$1+"]",rsFitz="\\ud83c[\\udffb-\\udfff]",rsModifier="(?:"+rsCombo+"|"+rsFitz+")",rsNonAstral="[^"+rsAstralRange$1+"]",rsRegional="(?:\\ud83c[\\udde6-\\uddff]){2}",rsSurrPair="[\\ud800-\\udbff][\\udc00-\\udfff]",rsZWJ$1="\\u200d",reOptMod=rsModifier+"?",rsOptVar="["+rsVarRange$1+"]?",rsOptJoin="(?:"+rsZWJ$1+"(?:"+[rsNonAstral,rsRegional,rsSurrPair].join("|")+")"+rsOptVar+reOptMod+")*",rsSeq=rsOptVar+reOptMod+rsOptJoin,rsSymbol="(?:"+[rsNonAstral+rsCombo+"?",rsCombo,rsRegional,rsSurrPair,rsAstral].join("|")+")",reUnicode=RegExp(rsFitz+"(?="+rsFitz+")|"+rsSymbol+rsSeq,"g"),reTrim=/^\s+|\s+$/g,FN_ARGS=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,FN_ARG_SPLIT=/,/,FN_ARG=/(=.+)?(\s*)$/,STRIP_COMMENTS=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,hasSetImmediate="function"==typeof setImmediate&&setImmediate,hasNextTick="object"==typeof process&&"function"==typeof process.nextTick,_defer;_defer=hasSetImmediate?setImmediate:hasNextTick?process.nextTick:fallback;var setImmediate$1=wrap(_defer);DLL.prototype.removeLink=function(e){return e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev,e.prev=e.next=null,this.length-=1,e},DLL.prototype.empty=DLL,DLL.prototype.insertAfter=function(e,t){t.prev=e,t.next=e.next,e.next?e.next.prev=t:this.tail=t,e.next=t,this.length+=1},DLL.prototype.insertBefore=function(e,t){t.prev=e.prev,t.next=e,e.prev?e.prev.next=t:this.head=t,e.prev=t,this.length+=1},DLL.prototype.unshift=function(e){this.head?this.insertBefore(this.head,e):setInitial(this,e)},DLL.prototype.push=function(e){this.tail?this.insertAfter(this.tail,e):setInitial(this,e)},DLL.prototype.shift=function(){return this.head&&this.removeLink(this.head)},DLL.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)};var eachOfSeries=doLimit(eachOfLimit,1),seq$1=rest(function(e){var t=arrayMap(e,wrapAsync$1);return rest(function(e){var r=this,n=e[e.length-1];"function"==typeof n?e.pop():n=noop,reduce(t,e,function(e,t,n){t.apply(r,e.concat(rest(function(e,t){n(e,t)})))},function(e,t){n.apply(r,[e].concat(t))})})}),compose=rest(function(e){return seq$1.apply(null,e.reverse())}),concat=doParallel(concat$1),concatSeries=doSeries(concat$1),constant=rest(function(e){var t=[null].concat(e);return initialParams(function(e,r){return r.apply(this,t)})}),detect=doParallel(_createTester(identity,_findGetResult)),detectLimit=doParallelLimit(_createTester(identity,_findGetResult)),detectSeries=doLimit(detectLimit,1),dir=consoleFunc("dir"),eachSeries=doLimit(eachLimit$1,1),every=doParallel(_createTester(notId,notId)),everyLimit=doParallelLimit(_createTester(notId,notId)),everySeries=doLimit(everyLimit,1),filter=doParallel(_filter),filterLimit=doParallelLimit(_filter),filterSeries=doLimit(filterLimit,1),groupByLimit=function(e,t,r,n){n=n||noop;var o=wrapAsync$1(r);mapLimit(e,t,function(e,t){o(e,function(r,n){return r?t(r):t(null,{key:n,val:e})})},function(e,t){for(var r={},o=Object.prototype.hasOwnProperty,i=0;i<t.length;i++)if(t[i]){var a=t[i].key,s=t[i].val;o.call(r,a)?r[a].push(s):r[a]=[s]}return n(e,r)})},groupBy=doLimit(groupByLimit,1/0),groupBySeries=doLimit(groupByLimit,1),log=consoleFunc("log"),mapValues=doLimit(mapValuesLimit,1/0),mapValuesSeries=doLimit(mapValuesLimit,1),_defer$1;_defer$1=hasNextTick?process.nextTick:hasSetImmediate?setImmediate:fallback;var nextTick=wrap(_defer$1),queue$1=function(e,t){var r=wrapAsync$1(e);return queue(function(e,t){r(e[0],t)},t,1)},priorityQueue=function(e,t){var r=queue$1(e,t);return r.push=function(e,t,n){if(null==n&&(n=noop),"function"!=typeof n)throw new Error("task callback must be a function");if(r.started=!0,isArray(e)||(e=[e]),0===e.length)return setImmediate$1(function(){r.drain()});t=t||0;for(var o=r._tasks.head;o&&t>=o.priority;)o=o.next;for(var i=0,a=e.length;i<a;i++){var s={data:e[i],priority:t,callback:n};o?r._tasks.insertBefore(o,s):r._tasks.push(s)}setImmediate$1(r.process)},delete r.unshift,r},slice=Array.prototype.slice,reject=doParallel(reject$1),rejectLimit=doParallelLimit(reject$1),rejectSeries=doLimit(rejectLimit,1),retryable=function(e,t){t||(t=e,e=null);var r=wrapAsync$1(t);return initialParams(function(t,n){function o(e){r.apply(null,t.concat(e))}e?retry(e,o,n):retry(o,n)})},some=doParallel(_createTester(Boolean,identity)),someLimit=doParallelLimit(_createTester(Boolean,identity)),someSeries=doLimit(someLimit,1),nativeCeil=Math.ceil,nativeMax$1=Math.max,times=doLimit(timeLimit,1/0),timesSeries=doLimit(timeLimit,1),waterfall=function(e,t){function r(o){if(n===e.length)return t.apply(null,[null].concat(o));var i=onlyOnce(rest(function(e,n){return e?t.apply(null,[e].concat(n)):void r(n)}));o.push(i);var a=wrapAsync$1(e[n++]);a.apply(null,o)}if(t=once(t||noop),!isArray(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var n=0;r([])},index={applyEach:applyEach,applyEachSeries:applyEachSeries,apply:apply$2,asyncify:asyncify,auto:auto,autoInject:autoInject,cargo:cargo,compose:compose,concat:concat,concatSeries:concatSeries,constant:constant,detect:detect,detectLimit:detectLimit,detectSeries:detectSeries,dir:dir,doDuring:doDuring,doUntil:doUntil,doWhilst:doWhilst,during:during,each:eachLimit,eachLimit:eachLimit$1,eachOf:eachOf,eachOfLimit:eachOfLimit,eachOfSeries:eachOfSeries,eachSeries:eachSeries,ensureAsync:ensureAsync,every:every,everyLimit:everyLimit,everySeries:everySeries,filter:filter,filterLimit:filterLimit,filterSeries:filterSeries,forever:forever,groupBy:groupBy,groupByLimit:groupByLimit,groupBySeries:groupBySeries,log:log,map:map,mapLimit:mapLimit,mapSeries:mapSeries,mapValues:mapValues,mapValuesLimit:mapValuesLimit,mapValuesSeries:mapValuesSeries,memoize:memoize,nextTick:nextTick,parallel:parallelLimit,parallelLimit:parallelLimit$1,priorityQueue:priorityQueue,queue:queue$1,race:race,reduce:reduce,reduceRight:reduceRight,reflect:reflect,reflectAll:reflectAll,reject:reject,rejectLimit:rejectLimit,rejectSeries:rejectSeries,retry:retry,retryable:retryable,seq:seq$1,series:series,setImmediate:setImmediate$1,some:some,someLimit:someLimit,someSeries:someSeries,sortBy:sortBy,timeout:timeout,times:times,timesLimit:timeLimit,timesSeries:timesSeries,transform:transform,unmemoize:unmemoize,until:until,waterfall:waterfall,whilst:whilst,all:every,any:some,forEach:eachLimit,forEachSeries:eachSeries,forEachLimit:eachLimit$1,forEachOf:eachOf,forEachOfSeries:eachOfSeries,forEachOfLimit:eachOfLimit,inject:reduce,foldl:reduce,foldr:reduceRight,select:filter,selectLimit:filterLimit,selectSeries:filterSeries,wrapSync:asyncify};exports.default=index,exports.applyEach=applyEach,exports.applyEachSeries=applyEachSeries,exports.apply=apply$2,exports.asyncify=asyncify,exports.auto=auto,exports.autoInject=autoInject,exports.cargo=cargo,exports.compose=compose,exports.concat=concat,exports.concatSeries=concatSeries,exports.constant=constant,exports.detect=detect,exports.detectLimit=detectLimit,exports.detectSeries=detectSeries,exports.dir=dir,exports.doDuring=doDuring,exports.doUntil=doUntil,exports.doWhilst=doWhilst,exports.during=during,exports.each=eachLimit,exports.eachLimit=eachLimit$1,exports.eachOf=eachOf,exports.eachOfLimit=eachOfLimit,exports.eachOfSeries=eachOfSeries,exports.eachSeries=eachSeries,exports.ensureAsync=ensureAsync,exports.every=every,exports.everyLimit=everyLimit,exports.everySeries=everySeries,exports.filter=filter,exports.filterLimit=filterLimit,exports.filterSeries=filterSeries,exports.forever=forever,exports.groupBy=groupBy,exports.groupByLimit=groupByLimit,exports.groupBySeries=groupBySeries,exports.log=log,exports.map=map,exports.mapLimit=mapLimit,exports.mapSeries=mapSeries,exports.mapValues=mapValues,exports.mapValuesLimit=mapValuesLimit,exports.mapValuesSeries=mapValuesSeries,exports.memoize=memoize,exports.nextTick=nextTick,exports.parallel=parallelLimit,exports.parallelLimit=parallelLimit$1,exports.priorityQueue=priorityQueue,exports.queue=queue$1,exports.race=race,exports.reduce=reduce,exports.reduceRight=reduceRight,exports.reflect=reflect,exports.reflectAll=reflectAll,exports.reject=reject,exports.rejectLimit=rejectLimit,exports.rejectSeries=rejectSeries,exports.retry=retry,exports.retryable=retryable,exports.seq=seq$1,exports.series=series,exports.setImmediate=setImmediate$1,exports.some=some,exports.someLimit=someLimit,exports.someSeries=someSeries,exports.sortBy=sortBy,exports.timeout=timeout,exports.times=times,exports.timesLimit=timeLimit,exports.timesSeries=timesSeries,exports.transform=transform,exports.unmemoize=unmemoize,exports.until=until,exports.waterfall=waterfall,exports.whilst=whilst,exports.all=every,exports.allLimit=everyLimit,exports.allSeries=everySeries,exports.any=some,exports.anyLimit=someLimit,exports.anySeries=someSeries,exports.find=detect,exports.findLimit=detectLimit,exports.findSeries=detectSeries,exports.forEach=eachLimit,exports.forEachSeries=eachSeries,exports.forEachLimit=eachLimit$1,exports.forEachOf=eachOf,exports.forEachOfSeries=eachOfSeries,exports.forEachOfLimit=eachOfLimit,exports.inject=reduce,exports.foldl=reduce,exports.foldr=reduceRight,exports.select=filter,exports.selectLimit=filterLimit,exports.selectSeries=filterSeries,exports.wrapSync=asyncify,Object.defineProperty(exports,"__esModule",{value:!0})}); +!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(n.async=n.async||{})}(this,function(n){"use strict";function t(n,t){t|=0;for(var e=Math.max(n.length-t,0),r=Array(e),u=0;u<e;u++)r[u]=n[t+u];return r}function e(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function r(n){setTimeout(n,0)}function u(n){return function(e){var r=t(arguments,1);n(function(){e.apply(null,r)})}}function o(n){return ft(function(t,r){var u;try{u=n.apply(this,t)}catch(n){return r(n)}e(u)&&"function"==typeof u.then?u.then(function(n){i(r,null,n)},function(n){i(r,n.message?n:new Error(n))}):r(null,u)})}function i(n,t,e){try{n(t,e)}catch(n){st(c,n)}}function c(n){throw n}function f(n){return pt&&"AsyncFunction"===n[Symbol.toStringTag]}function a(n){return f(n)?o(n):n}function l(n){return function(e){var r=t(arguments,1),u=ft(function(t,r){var u=this;return n(e,function(n,e){a(n).apply(u,t.concat(e))},r)});return r.length?u.apply(this,r):u}}function s(n){var t=gt.call(n,jt),e=n[jt];try{n[jt]=void 0;var r=!0}catch(n){}var u=bt.call(n);return r&&(t?n[jt]=e:delete n[jt]),u}function p(n){return kt.call(n)}function h(n){return null==n?void 0===n?wt:Ot:(n=Object(n),xt&&xt in n?s(n):p(n))}function y(n){if(!e(n))return!1;var t=h(n);return t==Et||t==At||t==Lt||t==Tt}function v(n){return"number"==typeof n&&n>-1&&n%1==0&&n<=Bt}function d(n){return null!=n&&v(n.length)&&!y(n)}function m(){}function g(n){return function(){if(null!==n){var t=n;n=null,t.apply(this,arguments)}}}function b(n,t){for(var e=-1,r=Array(n);++e<n;)r[e]=t(e);return r}function j(n){return null!=n&&"object"==typeof n}function S(n){return j(n)&&h(n)==Mt}function k(){return!1}function O(n,t){return t=null==t?Qt:t,!!t&&("number"==typeof n||Gt.test(n))&&n>-1&&n%1==0&&n<t}function w(n){return j(n)&&v(n.length)&&!!ge[h(n)]}function x(n){return function(t){return n(t)}}function L(n,t){var e=qt(n),r=!e&&Vt(n),u=!e&&!r&&Nt(n),o=!e&&!r&&!u&&xe(n),i=e||r||u||o,c=i?b(n.length,String):[],f=c.length;for(var a in n)!t&&!Ee.call(n,a)||i&&("length"==a||u&&("offset"==a||"parent"==a)||o&&("buffer"==a||"byteLength"==a||"byteOffset"==a)||O(a,f))||c.push(a);return c}function E(n){var t=n&&n.constructor,e="function"==typeof t&&t.prototype||Ae;return n===e}function A(n,t){return function(e){return n(t(e))}}function T(n){if(!E(n))return Te(n);var t=[];for(var e in Object(n))Fe.call(n,e)&&"constructor"!=e&&t.push(e);return t}function B(n){return d(n)?L(n):T(n)}function F(n){var t=-1,e=n.length;return function(){return++t<e?{value:n[t],key:t}:null}}function I(n){var t=-1;return function(){var e=n.next();return e.done?null:(t++,{value:e.value,key:t})}}function _(n){var t=B(n),e=-1,r=t.length;return function(){var u=t[++e];return e<r?{value:n[u],key:u}:null}}function M(n){if(d(n))return F(n);var t=_t(n);return t?I(t):_(n)}function U(n){return function(){if(null===n)throw new Error("Callback was already called.");var t=n;n=null,t.apply(this,arguments)}}function z(n){return function(t,e,r){function u(n,t){if(f-=1,n)c=!0,r(n);else{if(t===Ft||c&&f<=0)return c=!0,r(null);o()}}function o(){for(;f<n&&!c;){var t=i();if(null===t)return c=!0,void(f<=0&&r(null));f+=1,e(t.value,t.key,U(u))}}if(r=g(r||m),n<=0||!t)return r(null);var i=M(t),c=!1,f=0;o()}}function P(n,t,e,r){z(t)(n,a(e),r)}function V(n,t){return function(e,r,u){return n(e,t,r,u)}}function q(n,t,e){function r(n,t){n?e(n):++o!==i&&t!==Ft||e(null)}e=g(e||m);var u=0,o=0,i=n.length;for(0===i&&e(null);u<i;u++)t(n[u],u,U(r))}function D(n){return function(t,e,r){return n(_e,t,a(e),r)}}function R(n,t,e,r){r=r||m,t=t||[];var u=[],o=0,i=a(e);n(t,function(n,t,e){var r=o++;i(n,function(n,t){u[r]=t,e(n)})},function(n){r(n,u)})}function C(n){return function(t,e,r,u){return n(z(e),t,a(r),u)}}function $(n,t){for(var e=-1,r=null==n?0:n.length;++e<r&&t(n[e],e,n)!==!1;);return n}function W(n){return function(t,e,r){for(var u=-1,o=Object(t),i=r(t),c=i.length;c--;){var f=i[n?c:++u];if(e(o[f],f,o)===!1)break}return t}}function N(n,t){return n&&De(n,t,B)}function Q(n,t,e,r){for(var u=n.length,o=e+(r?1:-1);r?o--:++o<u;)if(t(n[o],o,n))return o;return-1}function G(n){return n!==n}function H(n,t,e){for(var r=e-1,u=n.length;++r<u;)if(n[r]===t)return r;return-1}function J(n,t,e){return t===t?H(n,t,e):Q(n,G,e)}function K(n,t){for(var e=-1,r=null==n?0:n.length,u=Array(r);++e<r;)u[e]=t(n[e],e,n);return u}function X(n){return"symbol"==typeof n||j(n)&&h(n)==Ce}function Y(n){if("string"==typeof n)return n;if(qt(n))return K(n,Y)+"";if(X(n))return Ne?Ne.call(n):"";var t=n+"";return"0"==t&&1/n==-$e?"-0":t}function Z(n,t,e){var r=-1,u=n.length;t<0&&(t=-t>u?0:u+t),e=e>u?u:e,e<0&&(e+=u),u=t>e?0:e-t>>>0,t>>>=0;for(var o=Array(u);++r<u;)o[r]=n[r+t];return o}function nn(n,t,e){var r=n.length;return e=void 0===e?r:e,!t&&e>=r?n:Z(n,t,e)}function tn(n,t){for(var e=n.length;e--&&J(t,n[e],0)>-1;);return e}function en(n,t){for(var e=-1,r=n.length;++e<r&&J(t,n[e],0)>-1;);return e}function rn(n){return n.split("")}function un(n){return Xe.test(n)}function on(n){return n.match(vr)||[]}function cn(n){return un(n)?on(n):rn(n)}function fn(n){return null==n?"":Y(n)}function an(n,t,e){if(n=fn(n),n&&(e||void 0===t))return n.replace(dr,"");if(!n||!(t=Y(t)))return n;var r=cn(n),u=cn(t),o=en(r,u),i=tn(r,u)+1;return nn(r,o,i).join("")}function ln(n){return n=n.toString().replace(jr,""),n=n.match(mr)[2].replace(" ",""),n=n?n.split(gr):[],n=n.map(function(n){return an(n.replace(br,""))})}function sn(n,t){var e={};N(n,function(n,t){function r(t,e){var r=K(u,function(n){return t[n]});r.push(e),a(n).apply(null,r)}var u,o=f(n),i=!o&&1===n.length||o&&0===n.length;if(qt(n))u=n.slice(0,-1),n=n[n.length-1],e[t]=u.concat(u.length>0?r:n);else if(i)e[t]=n;else{if(u=ln(n),0===n.length&&!o&&0===u.length)throw new Error("autoInject task functions require explicit parameters.");o||u.pop(),e[t]=u.concat(r)}}),Re(e,t)}function pn(){this.head=this.tail=null,this.length=0}function hn(n,t){n.length=1,n.head=n.tail=t}function yn(n,t,e){function r(n,t,e){if(null!=e&&"function"!=typeof e)throw new Error("task callback must be a function");if(l.started=!0,qt(n)||(n=[n]),0===n.length&&l.idle())return st(function(){l.drain()});for(var r=0,u=n.length;r<u;r++){var o={data:n[r],callback:e||m};t?l._tasks.unshift(o):l._tasks.push(o)}st(l.process)}function u(n){return function(t){i-=1;for(var e=0,r=n.length;e<r;e++){var u=n[e],o=J(c,u,0);o>=0&&c.splice(o),u.callback.apply(u,arguments),null!=t&&l.error(t,u.data)}i<=l.concurrency-l.buffer&&l.unsaturated(),l.idle()&&l.drain(),l.process()}}if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var o=a(n),i=0,c=[],f=!1,l={_tasks:new pn,concurrency:t,payload:e,saturated:m,unsaturated:m,buffer:t/4,empty:m,drain:m,error:m,started:!1,paused:!1,push:function(n,t){r(n,!1,t)},kill:function(){l.drain=m,l._tasks.empty()},unshift:function(n,t){r(n,!0,t)},remove:function(n){l._tasks.remove(n)},process:function(){if(!f){for(f=!0;!l.paused&&i<l.concurrency&&l._tasks.length;){var n=[],t=[],e=l._tasks.length;l.payload&&(e=Math.min(e,l.payload));for(var r=0;r<e;r++){var a=l._tasks.shift();n.push(a),t.push(a.data)}i+=1,c.push(n[0]),0===l._tasks.length&&l.empty(),i===l.concurrency&&l.saturated();var s=U(u(n));o(t,s)}f=!1}},length:function(){return l._tasks.length},running:function(){return i},workersList:function(){return c},idle:function(){return l._tasks.length+i===0},pause:function(){l.paused=!0},resume:function(){l.paused!==!1&&(l.paused=!1,st(l.process))}};return l}function vn(n,t){return yn(n,1,t)}function dn(n,t,e,r){r=g(r||m);var u=a(e);kr(n,function(n,e,r){u(t,n,function(n,e){t=e,r(n)})},function(n){r(n,t)})}function mn(){var n=K(arguments,a);return function(){var e=t(arguments),r=this,u=e[e.length-1];"function"==typeof u?e.pop():u=m,dn(n,e,function(n,e,u){e.apply(r,n.concat(function(n){var e=t(arguments,1);u(n,e)}))},function(n,t){u.apply(r,[n].concat(t))})}}function gn(n,t,e,r){var u=[];n(t,function(n,t,r){e(n,function(n,t){u=u.concat(t||[]),r(n)})},function(n){r(n,u)})}function bn(n){return function(t,e,r){return n(kr,t,a(e),r)}}function jn(n){return n}function Sn(n,t){return function(e,r,u,o){o=o||m;var i,c=!1;e(r,function(e,r,o){u(e,function(r,u){r?o(r):n(u)&&!i?(c=!0,i=t(!0,e),o(null,Ft)):o()})},function(n){n?o(n):o(null,c?i:t(!1))})}}function kn(n,t){return t}function On(n){return function(e){var r=t(arguments,1);r.push(function(e){var r=t(arguments,1);"object"==typeof console&&(e?console.error&&console.error(e):console[n]&&$(r,function(t){console[n](t)}))}),a(e).apply(null,r)}}function wn(n,e,r){function u(n){if(n)return r(n);var e=t(arguments,1);e.push(o),c.apply(this,e)}function o(n,t){return n?r(n):t?void i(u):r(null)}r=U(r||m);var i=a(n),c=a(e);o(null,!0)}function xn(n,e,r){r=U(r||m);var u=a(n),o=function(n){if(n)return r(n);var i=t(arguments,1);return e.apply(this,i)?u(o):void r.apply(null,[null].concat(i))};u(o)}function Ln(n,t,e){xn(n,function(){return!t.apply(this,arguments)},e)}function En(n,t,e){function r(n){return n?e(n):void i(u)}function u(n,t){return n?e(n):t?void o(r):e(null)}e=U(e||m);var o=a(t),i=a(n);i(u)}function An(n){return function(t,e,r){return n(t,r)}}function Tn(n,t,e){_e(n,An(a(t)),e)}function Bn(n,t,e,r){z(t)(n,An(a(e)),r)}function Fn(n){return f(n)?n:ft(function(t,e){var r=!0;t.push(function(){var n=arguments;r?st(function(){e.apply(null,n)}):e.apply(null,n)}),n.apply(this,t),r=!1})}function In(n){return!n}function _n(n){return function(t){return null==t?void 0:t[n]}}function Mn(n,t,e,r){var u=new Array(t.length);n(t,function(n,t,r){e(n,function(n,e){u[t]=!!e,r(n)})},function(n){if(n)return r(n);for(var e=[],o=0;o<t.length;o++)u[o]&&e.push(t[o]);r(null,e)})}function Un(n,t,e,r){var u=[];n(t,function(n,t,r){e(n,function(e,o){e?r(e):(o&&u.push({index:t,value:n}),r())})},function(n){n?r(n):r(null,K(u.sort(function(n,t){return n.index-t.index}),_n("value")))})}function zn(n,t,e,r){var u=d(t)?Mn:Un;u(n,t,a(e),r||m)}function Pn(n,t){function e(n){return n?r(n):void u(e)}var r=U(t||m),u=a(Fn(n));e()}function Vn(n,t,e,r){r=g(r||m);var u={},o=a(e);P(n,t,function(n,t,e){o(n,t,function(n,r){return n?e(n):(u[t]=r,void e())})},function(n){r(n,u)})}function qn(n,t){return t in n}function Dn(n,e){var r=Object.create(null),u=Object.create(null);e=e||jn;var o=a(n),i=ft(function(n,i){var c=e.apply(null,n);qn(r,c)?st(function(){i.apply(null,r[c])}):qn(u,c)?u[c].push(i):(u[c]=[i],o.apply(null,n.concat(function(){var n=t(arguments);r[c]=n;var e=u[c];delete u[c];for(var o=0,i=e.length;o<i;o++)e[o].apply(null,n)})))});return i.memo=r,i.unmemoized=n,i}function Rn(n,e,r){r=r||m;var u=d(e)?[]:{};n(e,function(n,e,r){a(n)(function(n,o){arguments.length>2&&(o=t(arguments,1)),u[e]=o,r(n)})},function(n){r(n,u)})}function Cn(n,t){Rn(_e,n,t)}function $n(n,t,e){Rn(z(t),n,e)}function Wn(n,t){if(t=g(t||m),!qt(n))return t(new TypeError("First argument to race must be an array of functions"));if(!n.length)return t();for(var e=0,r=n.length;e<r;e++)a(n[e])(t)}function Nn(n,e,r,u){var o=t(n).reverse();dn(o,e,r,u)}function Qn(n){var e=a(n);return ft(function(n,r){return n.push(function(n,e){if(n)r(null,{error:n});else{var u;u=arguments.length<=2?e:t(arguments,1),r(null,{value:u})}}),e.apply(this,n)})}function Gn(n,t,e,r){zn(n,t,function(n,t){e(n,function(n,e){t(n,!e)})},r)}function Hn(n){var t;return qt(n)?t=K(n,Qn):(t={},N(n,function(n,e){t[e]=Qn.call(this,n)})),t}function Jn(n){return function(){return n}}function Kn(n,t,e){function r(n,t){if("object"==typeof t)n.times=+t.times||o,n.intervalFunc="function"==typeof t.interval?t.interval:Jn(+t.interval||i),n.errorFilter=t.errorFilter;else{if("number"!=typeof t&&"string"!=typeof t)throw new Error("Invalid arguments for async.retry");n.times=+t||o}}function u(){f(function(n){n&&l++<c.times&&("function"!=typeof c.errorFilter||c.errorFilter(n))?setTimeout(u,c.intervalFunc(l)):e.apply(null,arguments)})}var o=5,i=0,c={times:o,intervalFunc:Jn(i)};if(arguments.length<3&&"function"==typeof n?(e=t||m,t=n):(r(c,n),e=e||m),"function"!=typeof t)throw new Error("Invalid arguments for async.retry");var f=a(t),l=1;u()}function Xn(n,t){Rn(kr,n,t)}function Yn(n,t,e){function r(n,t){var e=n.criteria,r=t.criteria;return e<r?-1:e>r?1:0}var u=a(t);Me(n,function(n,t){u(n,function(e,r){return e?t(e):void t(null,{value:n,criteria:r})})},function(n,t){return n?e(n):void e(null,K(t.sort(r),_n("value")))})}function Zn(n,t,e){var r=a(n);return ft(function(u,o){function i(){var t=n.name||"anonymous",r=new Error('Callback function "'+t+'" timed out.');r.code="ETIMEDOUT",e&&(r.info=e),f=!0,o(r)}var c,f=!1;u.push(function(){f||(o.apply(null,arguments),clearTimeout(c))}),c=setTimeout(i,t),r.apply(null,u)})}function nt(n,t,e,r){for(var u=-1,o=tu(nu((t-n)/(e||1)),0),i=Array(o);o--;)i[r?o:++u]=n,n+=e;return i}function tt(n,t,e,r){var u=a(e);ze(nt(0,n,1),t,u,r)}function et(n,t,e,r){arguments.length<=3&&(r=e,e=t,t=qt(n)?[]:{}),r=g(r||m);var u=a(e);_e(n,function(n,e,r){u(t,n,e,r)},function(n){r(n,t)})}function rt(n,e){var r,u=null;e=e||m,Fr(n,function(n,e){a(n)(function(n,o){r=arguments.length>2?t(arguments,1):o,u=n,e(!n)})},function(){e(u,r)})}function ut(n){return function(){return(n.unmemoized||n).apply(null,arguments)}}function ot(n,e,r){r=U(r||m);var u=a(e);if(!n())return r(null);var o=function(e){if(e)return r(e);if(n())return u(o);var i=t(arguments,1);r.apply(null,[null].concat(i))};u(o)}function it(n,t,e){ot(function(){return!n.apply(this,arguments)},t,e)}var ct,ft=function(n){return function(){var e=t(arguments),r=e.pop();n.call(this,e,r)}},at="function"==typeof setImmediate&&setImmediate,lt="object"==typeof process&&"function"==typeof process.nextTick;ct=at?setImmediate:lt?process.nextTick:r;var st=u(ct),pt="function"==typeof Symbol,ht="object"==typeof global&&global&&global.Object===Object&&global,yt="object"==typeof self&&self&&self.Object===Object&&self,vt=ht||yt||Function("return this")(),dt=vt.Symbol,mt=Object.prototype,gt=mt.hasOwnProperty,bt=mt.toString,jt=dt?dt.toStringTag:void 0,St=Object.prototype,kt=St.toString,Ot="[object Null]",wt="[object Undefined]",xt=dt?dt.toStringTag:void 0,Lt="[object AsyncFunction]",Et="[object Function]",At="[object GeneratorFunction]",Tt="[object Proxy]",Bt=9007199254740991,Ft={},It="function"==typeof Symbol&&Symbol.iterator,_t=function(n){return It&&n[It]&&n[It]()},Mt="[object Arguments]",Ut=Object.prototype,zt=Ut.hasOwnProperty,Pt=Ut.propertyIsEnumerable,Vt=S(function(){return arguments}())?S:function(n){return j(n)&&zt.call(n,"callee")&&!Pt.call(n,"callee")},qt=Array.isArray,Dt="object"==typeof n&&n&&!n.nodeType&&n,Rt=Dt&&"object"==typeof module&&module&&!module.nodeType&&module,Ct=Rt&&Rt.exports===Dt,$t=Ct?vt.Buffer:void 0,Wt=$t?$t.isBuffer:void 0,Nt=Wt||k,Qt=9007199254740991,Gt=/^(?:0|[1-9]\d*)$/,Ht="[object Arguments]",Jt="[object Array]",Kt="[object Boolean]",Xt="[object Date]",Yt="[object Error]",Zt="[object Function]",ne="[object Map]",te="[object Number]",ee="[object Object]",re="[object RegExp]",ue="[object Set]",oe="[object String]",ie="[object WeakMap]",ce="[object ArrayBuffer]",fe="[object DataView]",ae="[object Float32Array]",le="[object Float64Array]",se="[object Int8Array]",pe="[object Int16Array]",he="[object Int32Array]",ye="[object Uint8Array]",ve="[object Uint8ClampedArray]",de="[object Uint16Array]",me="[object Uint32Array]",ge={};ge[ae]=ge[le]=ge[se]=ge[pe]=ge[he]=ge[ye]=ge[ve]=ge[de]=ge[me]=!0,ge[Ht]=ge[Jt]=ge[ce]=ge[Kt]=ge[fe]=ge[Xt]=ge[Yt]=ge[Zt]=ge[ne]=ge[te]=ge[ee]=ge[re]=ge[ue]=ge[oe]=ge[ie]=!1;var be="object"==typeof n&&n&&!n.nodeType&&n,je=be&&"object"==typeof module&&module&&!module.nodeType&&module,Se=je&&je.exports===be,ke=Se&&ht.process,Oe=function(){try{return ke&&ke.binding("util")}catch(n){}}(),we=Oe&&Oe.isTypedArray,xe=we?x(we):w,Le=Object.prototype,Ee=Le.hasOwnProperty,Ae=Object.prototype,Te=A(Object.keys,Object),Be=Object.prototype,Fe=Be.hasOwnProperty,Ie=V(P,1/0),_e=function(n,t,e){var r=d(n)?q:Ie;r(n,a(t),e)},Me=D(R),Ue=l(Me),ze=C(R),Pe=V(ze,1),Ve=l(Pe),qe=function(n){var e=t(arguments,1);return function(){var r=t(arguments);return n.apply(null,e.concat(r))}},De=W(),Re=function(n,e,r){function u(n,t){j.push(function(){f(n,t)})}function o(){if(0===j.length&&0===v)return r(null,y);for(;j.length&&v<e;){var n=j.shift();n()}}function i(n,t){var e=b[n];e||(e=b[n]=[]),e.push(t)}function c(n){var t=b[n]||[];$(t,function(n){n()}),o()}function f(n,e){if(!d){var u=U(function(e,u){if(v--,arguments.length>2&&(u=t(arguments,1)),e){var o={};N(y,function(n,t){o[t]=n}),o[n]=u,d=!0,b=Object.create(null),r(e,o)}else y[n]=u,c(n)});v++;var o=a(e[e.length-1]);e.length>1?o(y,u):o(u)}}function l(){for(var n,t=0;S.length;)n=S.pop(),t++,$(s(n),function(n){0===--k[n]&&S.push(n)});if(t!==h)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}function s(t){var e=[];return N(n,function(n,r){qt(n)&&J(n,t,0)>=0&&e.push(r)}),e}"function"==typeof e&&(r=e,e=null),r=g(r||m);var p=B(n),h=p.length;if(!h)return r(null);e||(e=h);var y={},v=0,d=!1,b=Object.create(null),j=[],S=[],k={};N(n,function(t,e){if(!qt(t))return u(e,[t]),void S.push(e);var r=t.slice(0,t.length-1),o=r.length;return 0===o?(u(e,t),void S.push(e)):(k[e]=o,void $(r,function(c){if(!n[c])throw new Error("async.auto task `"+e+"` has a non-existent dependency `"+c+"` in "+r.join(", "));i(c,function(){o--,0===o&&u(e,t)})}))}),l(),o()},Ce="[object Symbol]",$e=1/0,We=dt?dt.prototype:void 0,Ne=We?We.toString:void 0,Qe="\\ud800-\\udfff",Ge="\\u0300-\\u036f\\ufe20-\\ufe23",He="\\u20d0-\\u20f0",Je="\\ufe0e\\ufe0f",Ke="\\u200d",Xe=RegExp("["+Ke+Qe+Ge+He+Je+"]"),Ye="\\ud800-\\udfff",Ze="\\u0300-\\u036f\\ufe20-\\ufe23",nr="\\u20d0-\\u20f0",tr="\\ufe0e\\ufe0f",er="["+Ye+"]",rr="["+Ze+nr+"]",ur="\\ud83c[\\udffb-\\udfff]",or="(?:"+rr+"|"+ur+")",ir="[^"+Ye+"]",cr="(?:\\ud83c[\\udde6-\\uddff]){2}",fr="[\\ud800-\\udbff][\\udc00-\\udfff]",ar="\\u200d",lr=or+"?",sr="["+tr+"]?",pr="(?:"+ar+"(?:"+[ir,cr,fr].join("|")+")"+sr+lr+")*",hr=sr+lr+pr,yr="(?:"+[ir+rr+"?",rr,cr,fr,er].join("|")+")",vr=RegExp(ur+"(?="+ur+")|"+yr+hr,"g"),dr=/^\s+|\s+$/g,mr=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,gr=/,/,br=/(=.+)?(\s*)$/,jr=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;pn.prototype.removeLink=function(n){return n.prev?n.prev.next=n.next:this.head=n.next,n.next?n.next.prev=n.prev:this.tail=n.prev,n.prev=n.next=null,this.length-=1,n},pn.prototype.empty=function(){for(;this.head;)this.shift();return this},pn.prototype.insertAfter=function(n,t){t.prev=n,t.next=n.next,n.next?n.next.prev=t:this.tail=t,n.next=t,this.length+=1},pn.prototype.insertBefore=function(n,t){t.prev=n.prev,t.next=n,n.prev?n.prev.next=t:this.head=t,n.prev=t,this.length+=1},pn.prototype.unshift=function(n){this.head?this.insertBefore(this.head,n):hn(this,n)},pn.prototype.push=function(n){this.tail?this.insertAfter(this.tail,n):hn(this,n)},pn.prototype.shift=function(){return this.head&&this.removeLink(this.head)},pn.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)},pn.prototype.toArray=function(){for(var n=Array(this.length),t=this.head,e=0;e<this.length;e++)n[e]=t.data,t=t.next;return n},pn.prototype.remove=function(n){for(var t=this.head;t;){var e=t.next;n(t)&&this.removeLink(t),t=e}return this};var Sr,kr=V(P,1),Or=function(){return mn.apply(null,t(arguments).reverse())},wr=D(gn),xr=bn(gn),Lr=function(){var n=t(arguments),e=[null].concat(n);return function(){var n=arguments[arguments.length-1];return n.apply(this,e)}},Er=D(Sn(jn,kn)),Ar=C(Sn(jn,kn)),Tr=V(Ar,1),Br=On("dir"),Fr=V(Bn,1),Ir=D(Sn(In,In)),_r=C(Sn(In,In)),Mr=V(_r,1),Ur=D(zn),zr=C(zn),Pr=V(zr,1),Vr=function(n,t,e,r){r=r||m;var u=a(e);ze(n,t,function(n,t){u(n,function(e,r){return e?t(e):t(null,{key:r,val:n})})},function(n,t){for(var e={},u=Object.prototype.hasOwnProperty,o=0;o<t.length;o++)if(t[o]){var i=t[o].key,c=t[o].val;u.call(e,i)?e[i].push(c):e[i]=[c]}return r(n,e)})},qr=V(Vr,1/0),Dr=V(Vr,1),Rr=On("log"),Cr=V(Vn,1/0),$r=V(Vn,1);Sr=lt?process.nextTick:at?setImmediate:r;var Wr=u(Sr),Nr=function(n,t){var e=a(n);return yn(function(n,t){e(n[0],t)},t,1)},Qr=function(n,t){var e=Nr(n,t);return e.push=function(n,t,r){if(null==r&&(r=m),"function"!=typeof r)throw new Error("task callback must be a function");if(e.started=!0,qt(n)||(n=[n]),0===n.length)return st(function(){e.drain()});t=t||0;for(var u=e._tasks.head;u&&t>=u.priority;)u=u.next;for(var o=0,i=n.length;o<i;o++){var c={data:n[o],priority:t,callback:r};u?e._tasks.insertBefore(u,c):e._tasks.push(c)}st(e.process)},delete e.unshift,e},Gr=D(Gn),Hr=C(Gn),Jr=V(Hr,1),Kr=function(n,t){t||(t=n,n=null);var e=a(t);return ft(function(t,r){function u(n){e.apply(null,t.concat(n))}n?Kn(n,u,r):Kn(u,r)})},Xr=D(Sn(Boolean,jn)),Yr=C(Sn(Boolean,jn)),Zr=V(Yr,1),nu=Math.ceil,tu=Math.max,eu=V(tt,1/0),ru=V(tt,1),uu=function(n,e){function r(t){var e=a(n[o++]);t.push(U(u)),e.apply(null,t)}function u(u){return u||o===n.length?e.apply(null,arguments):void r(t(arguments,1))}if(e=g(e||m),!qt(n))return e(new Error("First argument to waterfall must be an array of functions"));if(!n.length)return e();var o=0;r([])},ou={applyEach:Ue,applyEachSeries:Ve,apply:qe,asyncify:o,auto:Re,autoInject:sn,cargo:vn,compose:Or,concat:wr,concatSeries:xr,constant:Lr,detect:Er,detectLimit:Ar,detectSeries:Tr,dir:Br,doDuring:wn,doUntil:Ln,doWhilst:xn,during:En,each:Tn,eachLimit:Bn,eachOf:_e,eachOfLimit:P,eachOfSeries:kr,eachSeries:Fr,ensureAsync:Fn,every:Ir,everyLimit:_r,everySeries:Mr,filter:Ur,filterLimit:zr,filterSeries:Pr,forever:Pn,groupBy:qr,groupByLimit:Vr,groupBySeries:Dr,log:Rr,map:Me,mapLimit:ze,mapSeries:Pe,mapValues:Cr,mapValuesLimit:Vn,mapValuesSeries:$r,memoize:Dn,nextTick:Wr,parallel:Cn,parallelLimit:$n,priorityQueue:Qr,queue:Nr,race:Wn,reduce:dn,reduceRight:Nn,reflect:Qn,reflectAll:Hn,reject:Gr,rejectLimit:Hr,rejectSeries:Jr,retry:Kn,retryable:Kr,seq:mn,series:Xn,setImmediate:st,some:Xr,someLimit:Yr,someSeries:Zr,sortBy:Yn,timeout:Zn,times:eu,timesLimit:tt,timesSeries:ru,transform:et,tryEach:rt,unmemoize:ut,until:it,waterfall:uu,whilst:ot,all:Ir,any:Xr,forEach:Tn,forEachSeries:Fr,forEachLimit:Bn,forEachOf:_e,forEachOfSeries:kr,forEachOfLimit:P,inject:dn,foldl:dn,foldr:Nn,select:Ur,selectLimit:zr,selectSeries:Pr,wrapSync:o};n.default=ou,n.applyEach=Ue,n.applyEachSeries=Ve,n.apply=qe,n.asyncify=o,n.auto=Re,n.autoInject=sn,n.cargo=vn,n.compose=Or,n.concat=wr,n.concatSeries=xr,n.constant=Lr,n.detect=Er,n.detectLimit=Ar,n.detectSeries=Tr,n.dir=Br,n.doDuring=wn,n.doUntil=Ln,n.doWhilst=xn,n.during=En,n.each=Tn,n.eachLimit=Bn,n.eachOf=_e,n.eachOfLimit=P,n.eachOfSeries=kr,n.eachSeries=Fr,n.ensureAsync=Fn,n.every=Ir,n.everyLimit=_r,n.everySeries=Mr,n.filter=Ur,n.filterLimit=zr,n.filterSeries=Pr,n.forever=Pn,n.groupBy=qr,n.groupByLimit=Vr,n.groupBySeries=Dr,n.log=Rr,n.map=Me,n.mapLimit=ze,n.mapSeries=Pe,n.mapValues=Cr,n.mapValuesLimit=Vn,n.mapValuesSeries=$r,n.memoize=Dn,n.nextTick=Wr,n.parallel=Cn,n.parallelLimit=$n,n.priorityQueue=Qr,n.queue=Nr,n.race=Wn,n.reduce=dn,n.reduceRight=Nn,n.reflect=Qn,n.reflectAll=Hn,n.reject=Gr,n.rejectLimit=Hr,n.rejectSeries=Jr,n.retry=Kn,n.retryable=Kr,n.seq=mn,n.series=Xn,n.setImmediate=st,n.some=Xr,n.someLimit=Yr,n.someSeries=Zr,n.sortBy=Yn,n.timeout=Zn,n.times=eu,n.timesLimit=tt,n.timesSeries=ru,n.transform=et,n.tryEach=rt,n.unmemoize=ut,n.until=it,n.waterfall=uu,n.whilst=ot,n.all=Ir,n.allLimit=_r,n.allSeries=Mr,n.any=Xr,n.anyLimit=Yr,n.anySeries=Zr,n.find=Er,n.findLimit=Ar,n.findSeries=Tr,n.forEach=Tn,n.forEachSeries=Fr,n.forEachLimit=Bn,n.forEachOf=_e,n.forEachOfSeries=kr,n.forEachOfLimit=P,n.inject=dn,n.foldl=dn,n.foldr=Nn,n.select=Ur,n.selectLimit=zr,n.selectSeries=Pr,n.wrapSync=o,Object.defineProperty(n,"__esModule",{value:!0})}); //# sourceMappingURL=async.min.map
\ No newline at end of file diff --git a/node_modules/async/doDuring.js b/node_modules/async/doDuring.js index 8335283f1..6812990b0 100644 --- a/node_modules/async/doDuring.js +++ b/node_modules/async/doDuring.js @@ -9,9 +9,9 @@ var _noop = require('lodash/noop'); var _noop2 = _interopRequireDefault(_noop); -var _rest = require('./internal/rest'); +var _slice = require('./internal/slice'); -var _rest2 = _interopRequireDefault(_rest); +var _slice2 = _interopRequireDefault(_slice); var _onlyOnce = require('./internal/onlyOnce'); @@ -48,11 +48,12 @@ function doDuring(fn, test, callback) { var _fn = (0, _wrapAsync2.default)(fn); var _test = (0, _wrapAsync2.default)(test); - var next = (0, _rest2.default)(function (err, args) { + function next(err /*, ...args*/) { if (err) return callback(err); + var args = (0, _slice2.default)(arguments, 1); args.push(check); _test.apply(this, args); - }); + }; function check(err, truth) { if (err) return callback(err); diff --git a/node_modules/async/doWhilst.js b/node_modules/async/doWhilst.js index 0a410bfce..d93511314 100644 --- a/node_modules/async/doWhilst.js +++ b/node_modules/async/doWhilst.js @@ -9,9 +9,9 @@ var _noop = require('lodash/noop'); var _noop2 = _interopRequireDefault(_noop); -var _rest = require('./internal/rest'); +var _slice = require('./internal/slice'); -var _rest2 = _interopRequireDefault(_rest); +var _slice2 = _interopRequireDefault(_slice); var _onlyOnce = require('./internal/onlyOnce'); @@ -48,11 +48,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de function doWhilst(iteratee, test, callback) { callback = (0, _onlyOnce2.default)(callback || _noop2.default); var _iteratee = (0, _wrapAsync2.default)(iteratee); - var next = (0, _rest2.default)(function (err, args) { + var next = function (err /*, ...args*/) { if (err) return callback(err); + var args = (0, _slice2.default)(arguments, 1); if (test.apply(this, args)) return _iteratee(next); callback.apply(null, [null].concat(args)); - }); + }; _iteratee(next); } module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/async/index.js b/node_modules/async/index.js index e2b083bb2..1b1e2aaaa 100644 --- a/node_modules/async/index.js +++ b/node_modules/async/index.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -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.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.concat = exports.compose = exports.cargo = exports.autoInject = exports.auto = exports.asyncify = exports.apply = exports.applyEachSeries = exports.applyEach = undefined; +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.concat = exports.compose = exports.cargo = exports.autoInject = exports.auto = exports.asyncify = exports.apply = exports.applyEachSeries = exports.applyEach = undefined; var _applyEach = require('./applyEach'); @@ -289,6 +289,10 @@ var _transform = require('./transform'); var _transform2 = _interopRequireDefault(_transform); +var _tryEach = require('./tryEach'); + +var _tryEach2 = _interopRequireDefault(_tryEach); + var _unmemoize = require('./unmemoize'); var _unmemoize2 = _interopRequireDefault(_unmemoize); @@ -307,6 +311,70 @@ var _whilst2 = _interopRequireDefault(_whilst); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * An "async function" in the context of Async is an asynchronous function with + * a variable number of parameters, with the final parameter being a callback. + * (`function (arg1, arg2, ..., callback) {}`) + * The final callback is of the form `callback(err, results...)`, which must be + * called once the function is completed. The callback should be called with a + * Error as its first argument to signal that an error occurred. + * Otherwise, if no error occurred, it should be called with `null` as the first + * argument, and any additional `result` arguments that may apply, to signal + * successful completion. + * The callback must be called exactly once, ideally on a later tick of the + * JavaScript event loop. + * + * This type of function is also referred to as a "Node-style async function", + * or a "continuation passing-style function" (CPS). Most of the methods of this + * library are themselves CPS/Node-style async functions, or functions that + * return CPS/Node-style async functions. + * + * Wherever we accept a Node-style async function, we also directly accept an + * [ES2017 `async` function]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function}. + * In this case, the `async` function will not be passed a final callback + * argument, and any thrown error will be used as the `err` argument of the + * implicit callback, and the return value will be used as the `result` value. + * (i.e. a `rejected` of the returned Promise becomes the `err` callback + * argument, and a `resolved` value becomes the `result`.) + * + * Note, due to JavaScript limitations, we can only detect native `async` + * functions and not transpilied implementations. + * Your environment must have `async`/`await` support for this to work. + * (e.g. Node > v7.6, or a recent version of a modern browser). + * If you are using `async` functions through a transpiler (e.g. Babel), you + * must still wrap the function with [asyncify]{@link module:Utils.asyncify}, + * because the `async function` will be compiled to an ordinary function that + * returns a promise. + * + * @typedef {Function} AsyncFunction + * @static + */ + +/** + * Async is a utility module which provides straight-forward, powerful functions + * for working with asynchronous JavaScript. Although originally designed for + * use with [Node.js](http://nodejs.org) and installable via + * `npm install --save async`, it can also be used directly in the browser. + * @module async + * @see AsyncFunction + */ + +/** + * A collection of `async` functions for manipulating collections, such as + * arrays and objects. + * @module Collections + */ + +/** + * A collection of `async` functions for controlling the flow through a script. + * @module ControlFlow + */ + +/** + * A collection of `async` utility functions. + * @module Utils + */ + exports.default = { applyEach: _applyEach2.default, applyEachSeries: _applyEachSeries2.default, @@ -379,6 +447,7 @@ exports.default = { timesLimit: _timesLimit2.default, timesSeries: _timesSeries2.default, transform: _transform2.default, + tryEach: _tryEach2.default, unmemoize: _unmemoize2.default, until: _until2.default, waterfall: _waterfall2.default, @@ -400,70 +469,7 @@ exports.default = { selectLimit: _filterLimit2.default, selectSeries: _filterSeries2.default, wrapSync: _asyncify2.default -}; /** - * An "async function" in the context of Async is an asynchronous function with - * a variable number of parameters, with the final parameter being a callback. - * (`function (arg1, arg2, ..., callback) {}`) - * The final callback is of the form `callback(err, results...)`, which must be - * called once the function is completed. The callback should be called with a - * Error as its first argument to signal that an error occurred. - * Otherwise, if no error occurred, it should be called with `null` as the first - * argument, and any additional `result` arguments that may apply, to signal - * successful completion. - * The callback must be called exactly once, ideally on a later tick of the - * JavaScript event loop. - * - * This type of function is also referred to as a "Node-style async function", - * or a "continuation passing-style function" (CPS). Most of the methods of this - * library are themselves CPS/Node-style async functions, or functions that - * return CPS/Node-style async functions. - * - * Wherever we accept a Node-style async function, we also directly accept an - * [ES2017 `async` function]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function}. - * In this case, the `async` function will not be passed a final callback - * argument, and any thrown error will be used as the `err` argument of the - * implicit callback, and the return value will be used as the `result` value. - * (i.e. a `rejected` of the returned Promise becomes the `err` callback - * argument, and a `resolved` value becomes the `result`.) - * - * Note, due to JavaScript limitations, we can only detect native `async` - * functions and not transpilied implementations. - * Your environment must have `async`/`await` support for this to work. - * (e.g. Node > v7.6, or a recent version of a modern browser). - * If you are using `async` functions through a transpiler (e.g. Babel), you - * must still wrap the function with [asyncify]{@link module:Utils.asyncify}, - * because the `async function` will be compiled to an ordinary function that - * returns a promise. - * - * @typedef {Function} AsyncFunction - * @static - */ - -/** - * Async is a utility module which provides straight-forward, powerful functions - * for working with asynchronous JavaScript. Although originally designed for - * use with [Node.js](http://nodejs.org) and installable via - * `npm install --save async`, it can also be used directly in the browser. - * @module async - * @see AsyncFunction - */ - -/** - * A collection of `async` functions for manipulating collections, such as - * arrays and objects. - * @module Collections - */ - -/** - * A collection of `async` functions for controlling the flow through a script. - * @module ControlFlow - */ - -/** - * A collection of `async` utility functions. - * @module Utils - */ - +}; exports.applyEach = _applyEach2.default; exports.applyEachSeries = _applyEachSeries2.default; exports.apply = _apply2.default; @@ -535,6 +541,7 @@ exports.times = _times2.default; exports.timesLimit = _timesLimit2.default; exports.timesSeries = _timesSeries2.default; exports.transform = _transform2.default; +exports.tryEach = _tryEach2.default; exports.unmemoize = _unmemoize2.default; exports.until = _until2.default; exports.waterfall = _waterfall2.default; diff --git a/node_modules/async/internal/DoublyLinkedList.js b/node_modules/async/internal/DoublyLinkedList.js index 796d1230b..7e71728e2 100644 --- a/node_modules/async/internal/DoublyLinkedList.js +++ b/node_modules/async/internal/DoublyLinkedList.js @@ -27,7 +27,10 @@ DLL.prototype.removeLink = function (node) { return node; }; -DLL.prototype.empty = DLL; +DLL.prototype.empty = function () { + while (this.head) this.shift(); + return this; +}; DLL.prototype.insertAfter = function (node, newNode) { newNode.prev = node; @@ -60,4 +63,26 @@ DLL.prototype.shift = function () { DLL.prototype.pop = function () { return this.tail && this.removeLink(this.tail); }; + +DLL.prototype.toArray = function () { + var arr = Array(this.length); + var curr = this.head; + for (var idx = 0; idx < this.length; idx++) { + arr[idx] = curr.data; + curr = curr.next; + } + return arr; +}; + +DLL.prototype.remove = function (testFn) { + var curr = this.head; + while (!!curr) { + var next = curr.next; + if (testFn(curr)) { + this.removeLink(curr); + } + curr = next; + } + return this; +}; module.exports = exports["default"];
\ No newline at end of file diff --git a/node_modules/async/internal/applyEach.js b/node_modules/async/internal/applyEach.js index 92f1d2872..322e03ca7 100644 --- a/node_modules/async/internal/applyEach.js +++ b/node_modules/async/internal/applyEach.js @@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = applyEach; -var _rest = require('./rest'); +var _slice = require('./slice'); -var _rest2 = _interopRequireDefault(_rest); +var _slice2 = _interopRequireDefault(_slice); var _initialParams = require('./initialParams'); @@ -20,7 +20,8 @@ var _wrapAsync2 = _interopRequireDefault(_wrapAsync); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function applyEach(eachfn) { - return (0, _rest2.default)(function (fns, args) { + return function (fns /*, ...args*/) { + var args = (0, _slice2.default)(arguments, 1); var go = (0, _initialParams2.default)(function (args, callback) { var that = this; return eachfn(fns, function (fn, cb) { @@ -32,6 +33,6 @@ function applyEach(eachfn) { } else { return go; } - }); + }; } module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/async/internal/consoleFunc.js b/node_modules/async/internal/consoleFunc.js index 56c1de01c..603f48e8e 100644 --- a/node_modules/async/internal/consoleFunc.js +++ b/node_modules/async/internal/consoleFunc.js @@ -9,9 +9,9 @@ var _arrayEach = require('lodash/_arrayEach'); var _arrayEach2 = _interopRequireDefault(_arrayEach); -var _rest = require('./rest'); +var _slice = require('./slice'); -var _rest2 = _interopRequireDefault(_rest); +var _slice2 = _interopRequireDefault(_slice); var _wrapAsync = require('./wrapAsync'); @@ -20,8 +20,10 @@ var _wrapAsync2 = _interopRequireDefault(_wrapAsync); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function consoleFunc(name) { - return (0, _rest2.default)(function (fn, args) { - (0, _wrapAsync2.default)(fn).apply(null, args.concat((0, _rest2.default)(function (err, args) { + return function (fn /*, ...args*/) { + var args = (0, _slice2.default)(arguments, 1); + args.push(function (err /*, ...args*/) { + var args = (0, _slice2.default)(arguments, 1); if (typeof console === 'object') { if (err) { if (console.error) { @@ -33,7 +35,8 @@ function consoleFunc(name) { }); } } - }))); - }); + }); + (0, _wrapAsync2.default)(fn).apply(null, args); + }; } module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/async/internal/initialParams.js b/node_modules/async/internal/initialParams.js index 48f059ba4..df02cb1f1 100644 --- a/node_modules/async/internal/initialParams.js +++ b/node_modules/async/internal/initialParams.js @@ -5,15 +5,16 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = function (fn) { - return (0, _rest2.default)(function (args /*..., callback*/) { + return function () /*...args, callback*/{ + var args = (0, _slice2.default)(arguments); var callback = args.pop(); fn.call(this, args, callback); - }); + }; }; -var _rest = require('./rest'); +var _slice = require('./slice'); -var _rest2 = _interopRequireDefault(_rest); +var _slice2 = _interopRequireDefault(_slice); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } diff --git a/node_modules/async/internal/parallel.js b/node_modules/async/internal/parallel.js index 1a27c2a54..c97293b6c 100644 --- a/node_modules/async/internal/parallel.js +++ b/node_modules/async/internal/parallel.js @@ -13,9 +13,9 @@ var _isArrayLike = require('lodash/isArrayLike'); var _isArrayLike2 = _interopRequireDefault(_isArrayLike); -var _rest = require('./rest'); +var _slice = require('./slice'); -var _rest2 = _interopRequireDefault(_rest); +var _slice2 = _interopRequireDefault(_slice); var _wrapAsync = require('./wrapAsync'); @@ -28,13 +28,13 @@ function _parallel(eachfn, tasks, callback) { var results = (0, _isArrayLike2.default)(tasks) ? [] : {}; eachfn(tasks, function (task, key, callback) { - (0, _wrapAsync2.default)(task)((0, _rest2.default)(function (err, args) { - if (args.length <= 1) { - args = args[0]; + (0, _wrapAsync2.default)(task)(function (err, result) { + if (arguments.length > 2) { + result = (0, _slice2.default)(arguments, 1); } - results[key] = args; + results[key] = result; callback(err); - })); + }); }, function (err) { callback(err, results); }); diff --git a/node_modules/async/internal/queue.js b/node_modules/async/internal/queue.js index ff3d6d13a..8188368b9 100644 --- a/node_modules/async/internal/queue.js +++ b/node_modules/async/internal/queue.js @@ -17,10 +17,6 @@ var _noop = require('lodash/noop'); var _noop2 = _interopRequireDefault(_noop); -var _rest = require('./rest'); - -var _rest2 = _interopRequireDefault(_rest); - var _onlyOnce = require('./onlyOnce'); var _onlyOnce2 = _interopRequireDefault(_onlyOnce); @@ -81,7 +77,7 @@ function queue(worker, concurrency, payload) { } function _next(tasks) { - return (0, _rest2.default)(function (args) { + return function (err) { numRunning -= 1; for (var i = 0, l = tasks.length; i < l; i++) { @@ -91,10 +87,10 @@ function queue(worker, concurrency, payload) { workersList.splice(index); } - task.callback.apply(task, args); + task.callback.apply(task, arguments); - if (args[0] != null) { - q.error(args[0], task.data); + if (err != null) { + q.error(err, task.data); } } @@ -106,7 +102,7 @@ function queue(worker, concurrency, payload) { q.drain(); } q.process(); - }); + }; } var isProcessing = false; @@ -132,6 +128,9 @@ function queue(worker, concurrency, payload) { unshift: function (data, callback) { _insert(data, true, callback); }, + remove: function (testFn) { + q._tasks.remove(testFn); + }, process: function () { // Avoid trying to start too many processing operations. This can occur // when callbacks resolve synchronously (#1267). @@ -150,11 +149,12 @@ function queue(worker, concurrency, payload) { data.push(node.data); } + numRunning += 1; + workersList.push(tasks[0]); + if (q._tasks.length === 0) { q.empty(); } - numRunning += 1; - workersList.push(tasks[0]); if (numRunning === q.concurrency) { q.saturated(); diff --git a/node_modules/async/internal/rest.js b/node_modules/async/internal/rest.js deleted file mode 100644 index 9b2b57907..000000000 --- a/node_modules/async/internal/rest.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = rest; - -var _overRest2 = require('lodash/_overRest'); - -var _overRest3 = _interopRequireDefault(_overRest2); - -var _identity = require('lodash/identity'); - -var _identity2 = _interopRequireDefault(_identity); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// Lodash rest function without function.toString() -// remappings -function rest(func, start) { - return (0, _overRest3.default)(func, start, _identity2.default); -} -module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/async/internal/setImmediate.js b/node_modules/async/internal/setImmediate.js index 27e7f2e66..3545f2bcd 100644 --- a/node_modules/async/internal/setImmediate.js +++ b/node_modules/async/internal/setImmediate.js @@ -7,9 +7,9 @@ exports.hasNextTick = exports.hasSetImmediate = undefined; exports.fallback = fallback; exports.wrap = wrap; -var _rest = require('./rest'); +var _slice = require('./slice'); -var _rest2 = _interopRequireDefault(_rest); +var _slice2 = _interopRequireDefault(_slice); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -21,11 +21,12 @@ function fallback(fn) { } function wrap(defer) { - return (0, _rest2.default)(function (fn, args) { + return function (fn /*, ...args*/) { + var args = (0, _slice2.default)(arguments, 1); defer(function () { fn.apply(null, args); }); - }); + }; } var _defer; diff --git a/node_modules/async/internal/slice.js b/node_modules/async/internal/slice.js new file mode 100644 index 000000000..56f10c03e --- /dev/null +++ b/node_modules/async/internal/slice.js @@ -0,0 +1,16 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = slice; +function slice(arrayLike, start) { + start = start | 0; + var newLen = Math.max(arrayLike.length - start, 0); + var newArr = Array(newLen); + for (var idx = 0; idx < newLen; idx++) { + newArr[idx] = arrayLike[start + idx]; + } + return newArr; +} +module.exports = exports["default"];
\ No newline at end of file diff --git a/node_modules/async/internal/wrapAsync.js b/node_modules/async/internal/wrapAsync.js index 862dc90f2..bc6c96668 100644 --- a/node_modules/async/internal/wrapAsync.js +++ b/node_modules/async/internal/wrapAsync.js @@ -3,11 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.isAsync = exports.supportsAsync = undefined; - -var _identity = require('lodash/identity'); - -var _identity2 = _interopRequireDefault(_identity); +exports.isAsync = undefined; var _asyncify = require('../asyncify'); @@ -17,17 +13,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de var supportsSymbol = typeof Symbol === 'function'; -function supportsAsync() { - var supported; - try { - /* eslint no-eval: 0 */ - supported = isAsync(eval('(async function () {})')); - } catch (e) { - supported = false; - } - return supported; -} - function isAsync(fn) { return supportsSymbol && fn[Symbol.toStringTag] === 'AsyncFunction'; } @@ -36,6 +21,5 @@ function wrapAsync(asyncFn) { return isAsync(asyncFn) ? (0, _asyncify2.default)(asyncFn) : asyncFn; } -exports.default = supportsAsync() ? wrapAsync : _identity2.default; -exports.supportsAsync = supportsAsync; +exports.default = wrapAsync; exports.isAsync = isAsync;
\ No newline at end of file diff --git a/node_modules/async/memoize.js b/node_modules/async/memoize.js index 4942eb8a2..1f2b56691 100644 --- a/node_modules/async/memoize.js +++ b/node_modules/async/memoize.js @@ -9,9 +9,9 @@ var _identity = require('lodash/identity'); var _identity2 = _interopRequireDefault(_identity); -var _rest = require('./internal/rest'); +var _slice = require('./internal/slice'); -var _rest2 = _interopRequireDefault(_rest); +var _slice2 = _interopRequireDefault(_slice); var _setImmediate = require('./internal/setImmediate'); @@ -83,14 +83,15 @@ function memoize(fn, hasher) { queues[key].push(callback); } else { queues[key] = [callback]; - _fn.apply(null, args.concat((0, _rest2.default)(function (args) { + _fn.apply(null, args.concat(function () /*args*/{ + var args = (0, _slice2.default)(arguments); memo[key] = args; var q = queues[key]; delete queues[key]; for (var i = 0, l = q.length; i < l; i++) { q[i].apply(null, args); } - }))); + })); } }); memoized.memo = memo; diff --git a/node_modules/async/package.json b/node_modules/async/package.json index 51428e096..edce090a5 100644 --- a/node_modules/async/package.json +++ b/node_modules/async/package.json @@ -1,7 +1,7 @@ { "name": "async", "description": "Higher-order functions and common patterns for asynchronous code", - "version": "2.3.0", + "version": "2.4.1", "main": "dist/async.js", "author": "Caolan McMahon", "repository": { diff --git a/node_modules/async/queue.js b/node_modules/async/queue.js index 30ba41cad..0a61736d3 100644 --- a/node_modules/async/queue.js +++ b/node_modules/async/queue.js @@ -46,6 +46,12 @@ module.exports = exports['default']; * task in the list. Invoke with `queue.push(task, [callback])`, * @property {Function} unshift - add a new task to the front of the `queue`. * Invoke with `queue.unshift(task, [callback])`. + * @property {Function} remove - remove items from the queue that match a test + * function. The test function will be passed an object with a `data` property, + * and a `priority` property, if this is a + * [priorityQueue]{@link module:ControlFlow.priorityQueue} object. + * Invoked with `queue.remove(testFn)`, where `testFn` is of the form + * `function ({data, priority}) {}` and returns a Boolean. * @property {Function} saturated - a callback that is called when the number of * running workers hits the `concurrency` limit, and further tasks will be * queued. diff --git a/node_modules/async/reduceRight.js b/node_modules/async/reduceRight.js index 6401ba9fd..3d17d328a 100644 --- a/node_modules/async/reduceRight.js +++ b/node_modules/async/reduceRight.js @@ -9,9 +9,11 @@ var _reduce = require('./reduce'); var _reduce2 = _interopRequireDefault(_reduce); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _slice = require('./internal/slice'); + +var _slice2 = _interopRequireDefault(_slice); -var slice = Array.prototype.slice; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order. @@ -36,7 +38,7 @@ var slice = Array.prototype.slice; * (err, result). */ function reduceRight(array, memo, iteratee, callback) { - var reversed = slice.call(array).reverse(); + var reversed = (0, _slice2.default)(array).reverse(); (0, _reduce2.default)(reversed, memo, iteratee, callback); } module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/async/reflect.js b/node_modules/async/reflect.js index f8ab6358f..098ba8650 100644 --- a/node_modules/async/reflect.js +++ b/node_modules/async/reflect.js @@ -9,9 +9,9 @@ var _initialParams = require('./internal/initialParams'); var _initialParams2 = _interopRequireDefault(_initialParams); -var _rest = require('./internal/rest'); +var _slice = require('./internal/slice'); -var _rest2 = _interopRequireDefault(_rest); +var _slice2 = _interopRequireDefault(_slice); var _wrapAsync = require('./internal/wrapAsync'); @@ -61,23 +61,19 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de function reflect(fn) { var _fn = (0, _wrapAsync2.default)(fn); return (0, _initialParams2.default)(function reflectOn(args, reflectCallback) { - args.push((0, _rest2.default)(function callback(err, cbArgs) { - if (err) { - reflectCallback(null, { - error: err - }); + args.push(function callback(error, cbArg) { + if (error) { + reflectCallback(null, { error: error }); } else { - var value = null; - if (cbArgs.length === 1) { - value = cbArgs[0]; - } else if (cbArgs.length > 1) { - value = cbArgs; + var value; + if (arguments.length <= 2) { + value = cbArg; + } else { + value = (0, _slice2.default)(arguments, 1); } - reflectCallback(null, { - value: value - }); + reflectCallback(null, { value: value }); } - })); + }); return _fn.apply(this, args); }); diff --git a/node_modules/async/seq.js b/node_modules/async/seq.js index 873590de4..ff86ef92d 100644 --- a/node_modules/async/seq.js +++ b/node_modules/async/seq.js @@ -3,14 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = seq; var _noop = require('lodash/noop'); var _noop2 = _interopRequireDefault(_noop); -var _rest = require('./internal/rest'); +var _slice = require('./internal/slice'); -var _rest2 = _interopRequireDefault(_rest); +var _slice2 = _interopRequireDefault(_slice); var _reduce = require('./reduce'); @@ -64,9 +65,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * }); * }); */ -exports.default = (0, _rest2.default)(function seq(functions) { - var _functions = (0, _arrayMap2.default)(functions, _wrapAsync2.default); - return (0, _rest2.default)(function (args) { +function seq() /*...functions*/{ + var _functions = (0, _arrayMap2.default)(arguments, _wrapAsync2.default); + return function () /*...args*/{ + var args = (0, _slice2.default)(arguments); var that = this; var cb = args[args.length - 1]; @@ -77,12 +79,13 @@ exports.default = (0, _rest2.default)(function seq(functions) { } (0, _reduce2.default)(_functions, args, function (newargs, fn, cb) { - fn.apply(that, newargs.concat((0, _rest2.default)(function (err, nextargs) { + fn.apply(that, newargs.concat(function (err /*, ...nextargs*/) { + var nextargs = (0, _slice2.default)(arguments, 1); cb(err, nextargs); - }))); + })); }, function (err, results) { cb.apply(that, [err].concat(results)); }); - }); -}); + }; +} module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/async/timeout.js b/node_modules/async/timeout.js index 39fdc07c3..b5cb505eb 100644 --- a/node_modules/async/timeout.js +++ b/node_modules/async/timeout.js @@ -57,34 +57,33 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de * }); */ function timeout(asyncFn, milliseconds, info) { - var originalCallback, timer; - var timedOut = false; + var fn = (0, _wrapAsync2.default)(asyncFn); - function injectedCallback() { - if (!timedOut) { - originalCallback.apply(null, arguments); - clearTimeout(timer); - } - } + return (0, _initialParams2.default)(function (args, callback) { + var timedOut = false; + var timer; - function timeoutCallback() { - var name = asyncFn.name || 'anonymous'; - var error = new Error('Callback function "' + name + '" timed out.'); - error.code = 'ETIMEDOUT'; - if (info) { - error.info = info; + function timeoutCallback() { + var name = asyncFn.name || 'anonymous'; + var error = new Error('Callback function "' + name + '" timed out.'); + error.code = 'ETIMEDOUT'; + if (info) { + error.info = info; + } + timedOut = true; + callback(error); } - timedOut = true; - originalCallback(error); - } - var fn = (0, _wrapAsync2.default)(asyncFn); + args.push(function () { + if (!timedOut) { + callback.apply(null, arguments); + clearTimeout(timer); + } + }); - return (0, _initialParams2.default)(function (args, origCallback) { - originalCallback = origCallback; // setup timer and call original function timer = setTimeout(timeoutCallback, milliseconds); - fn.apply(null, args.concat(injectedCallback)); + fn.apply(null, args); }); } module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/async/tryEach.js b/node_modules/async/tryEach.js new file mode 100644 index 000000000..35cd00324 --- /dev/null +++ b/node_modules/async/tryEach.js @@ -0,0 +1,81 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = tryEach; + +var _noop = require('lodash/noop'); + +var _noop2 = _interopRequireDefault(_noop); + +var _eachSeries = require('./eachSeries'); + +var _eachSeries2 = _interopRequireDefault(_eachSeries); + +var _wrapAsync = require('./internal/wrapAsync'); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +var _slice = require('./internal/slice'); + +var _slice2 = _interopRequireDefault(_slice); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * It runs each task in series but stops whenever any of the functions were + * successful. If one of the tasks were successful, the `callback` will be + * passed the result of the successful task. If all tasks fail, the callback + * will be passed the error and result (if any) of the final attempt. + * + * @name tryEach + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Array|Iterable|Object} tasks - A collection containing functions to + * run, each function is passed a `callback(err, result)` it must call on + * completion with an error `err` (which can be `null`) and an optional `result` + * value. + * @param {Function} [callback] - An optional callback which is called when one + * of the tasks has succeeded, or all have failed. It receives the `err` and + * `result` arguments of the last attempt at completing the `task`. Invoked with + * (err, results). + * @example + * async.try([ + * function getDataFromFirstWebsite(callback) { + * // Try getting the data from the first website + * callback(err, data); + * }, + * function getDataFromSecondWebsite(callback) { + * // First website failed, + * // Try getting the data from the backup website + * callback(err, data); + * } + * ], + * // optional callback + * function(err, results) { + * Now do something with the data. + * }); + * + */ +function tryEach(tasks, callback) { + var error = null; + var result; + callback = callback || _noop2.default; + (0, _eachSeries2.default)(tasks, function (task, callback) { + (0, _wrapAsync2.default)(task)(function (err, res /*, ...args*/) { + if (arguments.length > 2) { + result = (0, _slice2.default)(arguments, 1); + } else { + result = res; + } + error = err; + callback(!err); + }); + }, function () { + callback(error, result); + }); +} +module.exports = exports['default'];
\ No newline at end of file diff --git a/node_modules/async/waterfall.js b/node_modules/async/waterfall.js index feda782cf..d547d6b1e 100644 --- a/node_modules/async/waterfall.js +++ b/node_modules/async/waterfall.js @@ -11,23 +11,18 @@ exports.default = function (tasks, callback) { var taskIndex = 0; function nextTask(args) { - if (taskIndex === tasks.length) { - return callback.apply(null, [null].concat(args)); - } - - var taskCallback = (0, _onlyOnce2.default)((0, _rest2.default)(function (err, args) { - if (err) { - return callback.apply(null, [err].concat(args)); - } - nextTask(args); - })); - - args.push(taskCallback); - var task = (0, _wrapAsync2.default)(tasks[taskIndex++]); + args.push((0, _onlyOnce2.default)(next)); task.apply(null, args); } + function next(err /*, ...args*/) { + if (err || taskIndex === tasks.length) { + return callback.apply(null, arguments); + } + nextTask((0, _slice2.default)(arguments, 1)); + } + nextTask([]); }; @@ -43,9 +38,9 @@ var _once = require('./internal/once'); var _once2 = _interopRequireDefault(_once); -var _rest = require('./internal/rest'); +var _slice = require('./internal/slice'); -var _rest2 = _interopRequireDefault(_rest); +var _slice2 = _interopRequireDefault(_slice); var _onlyOnce = require('./internal/onlyOnce'); diff --git a/node_modules/async/whilst.js b/node_modules/async/whilst.js index 6f9f0c90b..9c4d8f6ca 100644 --- a/node_modules/async/whilst.js +++ b/node_modules/async/whilst.js @@ -9,9 +9,9 @@ var _noop = require('lodash/noop'); var _noop2 = _interopRequireDefault(_noop); -var _rest = require('./internal/rest'); +var _slice = require('./internal/slice'); -var _rest2 = _interopRequireDefault(_rest); +var _slice2 = _interopRequireDefault(_slice); var _onlyOnce = require('./internal/onlyOnce'); @@ -61,11 +61,12 @@ function whilst(test, iteratee, callback) { callback = (0, _onlyOnce2.default)(callback || _noop2.default); var _iteratee = (0, _wrapAsync2.default)(iteratee); if (!test()) return callback(null); - var next = (0, _rest2.default)(function (err, args) { + var next = function (err /*, ...args*/) { if (err) return callback(err); if (test()) return _iteratee(next); + var args = (0, _slice2.default)(arguments, 1); callback.apply(null, [null].concat(args)); - }); + }; _iteratee(next); } module.exports = exports['default'];
\ No newline at end of file |