summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Early <alexander.early@gmail.com>2016-02-23 16:09:53 -0800
committerAlexander Early <alexander.early@gmail.com>2016-02-23 16:10:07 -0800
commit070ed49496d5cf0b3c31a8091608610961191238 (patch)
treee26f489e37ae3a227867b3d1dfe6c04afa361c23
parent3cf46d01b44c31203f4e59db280378a58d760d0d (diff)
downloadasync-modularization.tar.gz
gitignore build directoriesmodularization
-rw-r--r--.gitignore2
-rw-r--r--build-es/CHANGELOG.md125
-rw-r--r--build-es/LICENSE19
-rw-r--r--build-es/README.md1888
-rw-r--r--build-es/apply.js9
-rw-r--r--build-es/applyEach.js6
-rw-r--r--build-es/applyEachSeries.js6
-rw-r--r--build-es/asyncify.js26
-rw-r--r--build-es/auto.js114
-rw-r--r--build-es/cargo.js7
-rw-r--r--build-es/compose.js9
-rw-r--r--build-es/concat.js6
-rw-r--r--build-es/concatSeries.js6
-rw-r--r--build-es/constant.js10
-rw-r--r--build-es/detect.js9
-rw-r--r--build-es/detectLimit.js9
-rw-r--r--build-es/detectSeries.js9
-rw-r--r--build-es/dir.js5
-rw-r--r--build-es/doDuring.js12
-rw-r--r--build-es/doUntil.js9
-rw-r--r--build-es/doWhilst.js10
-rw-r--r--build-es/during.js25
-rw-r--r--build-es/each.js8
-rw-r--r--build-es/eachLimit.js9
-rw-r--r--build-es/eachOf.js34
-rw-r--r--build-es/eachOfLimit.js7
-rw-r--r--build-es/eachOfSeries.js40
-rw-r--r--build-es/eachSeries.js8
-rw-r--r--build-es/ensureAsync.js24
-rw-r--r--build-es/every.js7
-rw-r--r--build-es/everyLimit.js7
-rw-r--r--build-es/filter.js6
-rw-r--r--build-es/filterLimit.js6
-rw-r--r--build-es/filterSeries.js6
-rw-r--r--build-es/forever.js17
-rw-r--r--build-es/index.js228
-rw-r--r--build-es/internal/applyEach.js22
-rw-r--r--build-es/internal/concat.js13
-rw-r--r--build-es/internal/consoleFunc.js23
-rw-r--r--build-es/internal/createTester.js37
-rw-r--r--build-es/internal/doParallel.js9
-rw-r--r--build-es/internal/doParallelLimit.js9
-rw-r--r--build-es/internal/doSeries.js9
-rw-r--r--build-es/internal/eachOfLimit.js49
-rw-r--r--build-es/internal/filter.js30
-rw-r--r--build-es/internal/findGetResult.js5
-rw-r--r--build-es/internal/keyIterator.js23
-rw-r--r--build-es/internal/map.js19
-rw-r--r--build-es/internal/notId.js5
-rw-r--r--build-es/internal/onlyOnce.js9
-rw-r--r--build-es/internal/parallel.js22
-rw-r--r--build-es/internal/queue.js140
-rw-r--r--build-es/internal/reject.js15
-rw-r--r--build-es/internal/setImmediate.js19
-rw-r--r--build-es/internal/withoutIndex.js7
-rw-r--r--build-es/iterator.js17
-rw-r--r--build-es/log.js5
-rw-r--r--build-es/map.js6
-rw-r--r--build-es/mapLimit.js6
-rw-r--r--build-es/mapSeries.js6
-rw-r--r--build-es/memoize.js37
-rw-r--r--build-es/nextTick.js7
-rw-r--r--build-es/package.json70
-rw-r--r--build-es/parallel.js8
-rw-r--r--build-es/parallelLimit.js8
-rw-r--r--build-es/priorityQueue.js72
-rw-r--r--build-es/queue.js9
-rw-r--r--build-es/reduce.js14
-rw-r--r--build-es/reduceRight.js10
-rw-r--r--build-es/reject.js6
-rw-r--r--build-es/rejectLimit.js6
-rw-r--r--build-es/rejectSeries.js6
-rw-r--r--build-es/retry.js77
-rw-r--r--build-es/seq.js28
-rw-r--r--build-es/series.js8
-rw-r--r--build-es/setImmediate.js5
-rw-r--r--build-es/some.js8
-rw-r--r--build-es/someLimit.js7
-rw-r--r--build-es/sortBy.js23
-rw-r--r--build-es/times.js8
-rw-r--r--build-es/timesLimit.js8
-rw-r--r--build-es/timesSeries.js8
-rw-r--r--build-es/transform.js19
-rw-r--r--build-es/unmemoize.js7
-rw-r--r--build-es/until.js9
-rw-r--r--build-es/waterfall.js32
-rw-r--r--build-es/whilst.js15
-rw-r--r--build/CHANGELOG.md125
-rw-r--r--build/LICENSE19
-rw-r--r--build/README.md1888
-rw-r--r--build/apply.js18
-rw-r--r--build/applyEach.js18
-rw-r--r--build/applyEachSeries.js18
-rw-r--r--build/asyncify.js39
-rw-r--r--build/auto.js149
-rw-r--r--build/bower.json67
-rw-r--r--build/cargo.js17
-rw-r--r--build/component.json17
-rw-r--r--build/compose.js19
-rw-r--r--build/concat.js18
-rw-r--r--build/concatSeries.js18
-rw-r--r--build/constant.js19
-rw-r--r--build/detect.js26
-rw-r--r--build/detectLimit.js26
-rw-r--r--build/detectSeries.js26
-rw-r--r--build/dir.js14
-rw-r--r--build/dist/async.js2563
-rw-r--r--build/dist/async.min.js2
-rw-r--r--build/doDuring.js22
-rw-r--r--build/doUntil.js19
-rw-r--r--build/doWhilst.js20
-rw-r--r--build/during.js38
-rw-r--r--build/each.js21
-rw-r--r--build/eachLimit.js21
-rw-r--r--build/eachOf.js53
-rw-r--r--build/eachOfLimit.js17
-rw-r--r--build/eachOfSeries.js61
-rw-r--r--build/eachSeries.js21
-rw-r--r--build/ensureAsync.js36
-rw-r--r--build/every.js22
-rw-r--r--build/everyLimit.js22
-rw-r--r--build/filter.js18
-rw-r--r--build/filterLimit.js18
-rw-r--r--build/filterSeries.js18
-rw-r--r--build/forever.js32
-rw-r--r--build/index.js415
-rw-r--r--build/internal/applyEach.js30
-rw-r--r--build/internal/concat.js18
-rw-r--r--build/internal/consoleFunc.js35
-rw-r--r--build/internal/createTester.js42
-rw-r--r--build/internal/doParallel.js19
-rw-r--r--build/internal/doParallelLimit.js19
-rw-r--r--build/internal/doSeries.js19
-rw-r--r--build/internal/eachOfLimit.js66
-rw-r--r--build/internal/filter.js41
-rw-r--r--build/internal/findGetResult.js10
-rw-r--r--build/internal/keyIterator.js36
-rw-r--r--build/internal/map.js35
-rw-r--r--build/internal/notId.js10
-rw-r--r--build/internal/onlyOnce.js14
-rw-r--r--build/internal/parallel.js38
-rw-r--r--build/internal/queue.js166
-rw-r--r--build/internal/reject.js25
-rw-r--r--build/internal/setImmediate.js23
-rw-r--r--build/internal/withoutIndex.js12
-rw-r--r--build/iterator.js23
-rw-r--r--build/log.js14
-rw-r--r--build/map.js18
-rw-r--r--build/mapLimit.js18
-rw-r--r--build/mapSeries.js18
-rw-r--r--build/memoize.js55
-rw-r--r--build/nextTick.js16
-rw-r--r--build/package.json94
-rw-r--r--build/parallel.js21
-rw-r--r--build/parallelLimit.js21
-rw-r--r--build/priorityQueue.js92
-rw-r--r--build/queue.js19
-rw-r--r--build/reduce.js24
-rw-r--r--build/reduceRight.js20
-rw-r--r--build/reject.js18
-rw-r--r--build/rejectLimit.js18
-rw-r--r--build/rejectSeries.js18
-rw-r--r--build/retry.js87
-rw-r--r--build/seq.js43
-rw-r--r--build/series.js21
-rw-r--r--build/setImmediate.js14
-rw-r--r--build/some.js22
-rw-r--r--build/someLimit.js22
-rw-r--r--build/sortBy.js39
-rw-r--r--build/times.js21
-rw-r--r--build/timesLimit.js21
-rw-r--r--build/timesSeries.js21
-rw-r--r--build/transform.js31
-rw-r--r--build/unmemoize.js12
-rw-r--r--build/until.js19
-rw-r--r--build/waterfall.js56
-rw-r--r--build/whilst.js28
177 files changed, 2 insertions, 11348 deletions
diff --git a/.gitignore b/.gitignore
index edc86ec..1f05292 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,5 @@ coverage
.DS_Store
npm-debug.log
tmp
+build
+build-es
diff --git a/build-es/CHANGELOG.md b/build-es/CHANGELOG.md
deleted file mode 100644
index f15e081..0000000
--- a/build-es/CHANGELOG.md
+++ /dev/null
@@ -1,125 +0,0 @@
-# v1.5.2
-- Allow using `"consructor"` as an argument in `memoize` (#998)
-- Give a better error messsage when `auto` dependency checking fails (#994)
-- Various doc updates (#936, #956, #979, #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 now properly stop execution when an error occurs (#988, #993)
-- Various doc fixes (#971, #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 of running tasks (#637)
-- Added `queue#workersList()`, to retrieve the list of currently running tasks. (#891)
-- Various code simplifications (#896, #904)
-- Various doc fixes :scroll: (#890, #894, #903, #905, #912)
-
-# v1.4.2
-
-- Ensure coverage files don't get published on npm (#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)
-
-# 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)
-- Code simplifications and optimizations aplenty ([diff](https://github.com/caolan/async/compare/v1.3.0...v1.4.0))
-
-
-# v1.3.0
-
-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)
-
-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)
-
-
-# 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)
-
-
-# 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)
-
-Bug Fixes:
-
-- Fixed a regression in `each` and family with empty arrays that have additional properties. (#775, #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)
-
-
-# v1.1.0
-
-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)
-- 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)
-- Reduced file size by 4kb, (minified version by 1kb)
-- Added code coverage through `nyc` and `coveralls` (#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)
-
-
-# v1.0.0
-
-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)
-- Optimize internal `_each`, `_map` and `_keys` functions.
diff --git a/build-es/LICENSE b/build-es/LICENSE
deleted file mode 100644
index 9fe85b9..0000000
--- a/build-es/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2010-2016 Caolan McMahon
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/build-es/README.md b/build-es/README.md
deleted file mode 100644
index 70f68f0..0000000
--- a/build-es/README.md
+++ /dev/null
@@ -1,1888 +0,0 @@
-**NOTE: This is the README for Async 2.0, currently under development. For docs for async@1.5.2 go [HERE](https://github.com/caolan/async/blob/v1.5.2/README.md).
-
-# Async.js v2.0.0-pre
-
-[![Build Status via Travis CI](https://travis-ci.org/caolan/async.svg?branch=master)](https://travis-ci.org/caolan/async)
-[![NPM version](http://img.shields.io/npm/v/async.svg)](https://www.npmjs.org/package/async)
-[![Coverage Status](https://coveralls.io/repos/caolan/async/badge.svg?branch=master)](https://coveralls.io/r/caolan/async?branch=master)
-[![Join the chat at https://gitter.im/caolan/async](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/caolan/async?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-
-
-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 async`,
-it can also be used directly in the browser.
-
-Async is also installable via:
-
-- [bower](http://bower.io/): `bower install async`
-- [component](https://github.com/component/component): `component install caolan/async`
-- [jam](http://jamjs.org/): `jam install async`
-- [spm](http://spmjs.io/): `spm install async`
-
-Async provides around 20 functions that include the usual 'functional'
-suspects (`map`, `reduce`, `filter`, `each`…) as well as some common patterns
-for asynchronous control flow (`parallel`, `series`, `waterfall`…). All these
-functions assume you follow the Node.js convention of providing a single
-callback as the last argument of your `async` function.
-
-
-## Quick Examples
-
-```js
-async.map(['file1','file2','file3'], fs.stat, function(err, results){
- // results is now an array of stats for each file
-});
-
-async.filter(['file1','file2','file3'], function(filePath, callback) {
- fs.access(filePath, function(err) {
- callback(null, !err)
- });
-}, function(err, results){
- // results now equals an array of the existing files
-});
-
-async.parallel([
- function(){ ... },
- function(){ ... }
-], callback);
-
-async.series([
- function(){ ... },
- function(){ ... }
-]);
-```
-
-There are many more functions available so take a look at the docs below for a
-full list. This module aims to be comprehensive, so if you feel anything is
-missing please create a GitHub issue for it.
-
-## Common Pitfalls <sub>[(StackOverflow)](http://stackoverflow.com/questions/tagged/async.js)</sub>
-### Synchronous iteration functions
-
-If you get an error like `RangeError: Maximum call stack size exceeded.` or other stack overflow issues when using async, you are likely using a synchronous iteratee. By *synchronous* we mean a function that calls its callback on the same tick in the javascript event loop, without doing any I/O or using any timers. Calling many callbacks iteratively will quickly overflow the stack. If you run into this issue, just defer your callback with `async.setImmediate` to start a new call stack on the next tick of the event loop.
-
-This can also arise by accident if you callback early in certain cases:
-
-```js
-async.eachSeries(hugeArray, function iteratee(item, callback) {
- if (inCache(item)) {
- callback(null, cache[item]); // if many items are cached, you'll overflow
- } else {
- doSomeIO(item, callback);
- }
-}, function done() {
- //...
-});
-```
-
-Just change it to:
-
-```js
-async.eachSeries(hugeArray, function iteratee(item, callback) {
- if (inCache(item)) {
- async.setImmediate(function () {
- callback(null, cache[item]);
- });
- } else {
- doSomeIO(item, callback);
- //...
-```
-
-Async guards against synchronous functions in some, but not all, cases. If you are still running into stack overflows, you can defer as suggested above, or wrap functions with [`async.ensureAsync`](#ensureAsync) Functions that are asynchronous by their nature do not have this problem and don't need the extra callback deferral.
-
-If JavaScript's event loop is still a bit nebulous, check out [this article](http://blog.carbonfive.com/2013/10/27/the-javascript-event-loop-explained/) or [this talk](http://2014.jsconf.eu/speakers/philip-roberts-what-the-heck-is-the-event-loop-anyway.html) for more detailed information about how it works.
-
-
-### Multiple callbacks
-
-Make sure to always `return` when calling a callback early, otherwise you will cause multiple callbacks and unpredictable behavior in many cases.
-
-```js
-async.waterfall([
- function (callback) {
- getSomething(options, function (err, result) {
- if (err) {
- callback(new Error("failed getting something:" + err.message));
- // we should return here
- }
- // since we did not return, this callback still will be called and
- // `processData` will be called twice
- callback(null, result);
- });
- },
- processData
-], done)
-```
-
-It is always good practice to `return callback(err, result)` whenever a callback call is not the last statement of a function.
-
-
-### Binding a context to an iteratee
-
-This section is really about `bind`, not about `async`. If you are wondering how to
-make `async` execute your iteratees in a given context, or are confused as to why
-a method of another library isn't working as an iteratee, study this example:
-
-```js
-// Here is a simple object with an (unnecessarily roundabout) squaring method
-var AsyncSquaringLibrary = {
- squareExponent: 2,
- square: function(number, callback){
- var result = Math.pow(number, this.squareExponent);
- setTimeout(function(){
- callback(null, result);
- }, 200);
- }
-};
-
-async.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){
- // result is [NaN, NaN, NaN]
- // This fails because the `this.squareExponent` expression in the square
- // function is not evaluated in the context of AsyncSquaringLibrary, and is
- // therefore undefined.
-});
-
-async.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){
- // result is [1, 4, 9]
- // With the help of bind we can attach a context to the iteratee before
- // passing it to async. Now the square function will be executed in its
- // 'home' AsyncSquaringLibrary context and the value of `this.squareExponent`
- // will be as expected.
-});
-```
-
-## Download
-
-The source is available for download from
-[GitHub](https://github.com/caolan/async/blob/master/lib/async.js).
-Alternatively, you can install using Node Package Manager (`npm`):
-
- npm install async
-
-As well as using Bower:
-
- bower install async
-
-__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed
-
-## In the Browser
-
-So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5.
-
-Usage:
-
-```html
-<script type="text/javascript" src="async.js"></script>
-<script type="text/javascript">
-
- async.map(data, asyncProcess, function(err, results){
- alert(results);
- });
-
-</script>
-```
-
-## Documentation
-
-Some functions are also available in the following forms:
-* `<name>Series` - the same as `<name>` but runs only a single async operation at a time
-* `<name>Limit` - the same as `<name>` but runs a maximum of `limit` async operations at a time
-
-### Collections
-
-* [`each`](#each), `eachSeries`, `eachLimit`
-* [`forEachOf`](#forEachOf), `forEachOfSeries`, `forEachOfLimit`
-* [`map`](#map), `mapSeries`, `mapLimit`
-* [`filter`](#filter), `filterSeries`, `filterLimit`
-* [`reject`](#reject), `rejectSeries`, `rejectLimit`
-* [`reduce`](#reduce), [`reduceRight`](#reduceRight)
-* [`detect`](#detect), `detectSeries`, `detectLimit`
-* [`sortBy`](#sortBy)
-* [`some`](#some), `someLimit`
-* [`every`](#every), `everyLimit`
-* [`concat`](#concat), `concatSeries`
-
-### Control Flow
-
-* [`series`](#seriestasks-callback)
-* [`parallel`](#parallel), `parallelLimit`
-* [`whilst`](#whilst), [`doWhilst`](#doWhilst)
-* [`until`](#until), [`doUntil`](#doUntil)
-* [`during`](#during), [`doDuring`](#doDuring)
-* [`forever`](#forever)
-* [`waterfall`](#waterfall)
-* [`compose`](#compose)
-* [`seq`](#seq)
-* [`applyEach`](#applyEach), `applyEachSeries`
-* [`queue`](#queue), [`priorityQueue`](#priorityQueue)
-* [`cargo`](#cargo)
-* [`auto`](#auto)
-* [`retry`](#retry)
-* [`iterator`](#iterator)
-* [`times`](#times), `timesSeries`, `timesLimit`
-
-### Utils
-
-* [`apply`](#apply)
-* [`nextTick`](#nextTick)
-* [`memoize`](#memoize)
-* [`unmemoize`](#unmemoize)
-* [`ensureAsync`](#ensureAsync)
-* [`constant`](#constant)
-* [`asyncify`](#asyncify)
-* [`wrapSync`](#wrapSync)
-* [`log`](#log)
-* [`dir`](#dir)
-* [`noConflict`](#noConflict)
-
-## Collections
-
-<a name="forEach"></a>
-<a name="each"></a>
-### each(arr, iteratee, [callback])
-
-Applies the function `iteratee` to each item in `arr`, in parallel.
-The `iteratee` is called with an item from the list, and a callback for when it
-has finished. If the `iteratee` passes an error to its `callback`, the main
-`callback` (for the `each` function) is immediately called with the error.
-
-Note, that since this function applies `iteratee` to each item in parallel,
-there is no guarantee that the iteratee functions will complete in order.
-
-__Arguments__
-
-* `arr` - An array to iterate over.
-* `iteratee(item, callback)` - A function to apply to each item in `arr`.
- The iteratee is passed a `callback(err)` which must be called once it has
- completed. If no error has occurred, the `callback` should be run without
- arguments or with an explicit `null` argument. The array index is not passed
- to the iteratee. If you need the index, use [`forEachOf`](#forEachOf).
-* `callback(err)` - *Optional* A callback which is called when all `iteratee` functions
- have finished, or an error occurs.
-
-__Examples__
-
-
-```js
-// assuming openFiles is an array of file names and saveFile is a function
-// to save the modified contents of that file:
-
-async.each(openFiles, saveFile, function(err){
- // if any of the saves produced an error, err would equal that error
-});
-```
-
-```js
-// assuming openFiles is an array of file names
-
-async.each(openFiles, function(file, callback) {
-
- // Perform operation on file here.
- console.log('Processing file ' + file);
-
- if( file.length > 32 ) {
- console.log('This file name is too long');
- callback('File name too long');
- } else {
- // Do work to process file here
- console.log('File processed');
- callback();
- }
-}, function(err){
- // if any of the file processing produced an error, err would equal that error
- if( err ) {
- // One of the iterations produced an error.
- // All processing will now stop.
- console.log('A file failed to process');
- } else {
- console.log('All files have been processed successfully');
- }
-});
-```
-
-__Related__
-
-* eachSeries(arr, iteratee, [callback])
-* eachLimit(arr, limit, iteratee, [callback])
-
----------------------------------------
-
-<a name="forEachOf"></a>
-<a name="eachOf"></a>
-### forEachOf(obj, iteratee, [callback])
-
-Like `each`, except that it iterates over objects, and passes the key as the second argument to the iteratee.
-
-__Arguments__
-
-* `obj` - An object or array to iterate over.
-* `iteratee(item, key, callback)` - A function to apply to each item in `obj`.
-The `key` is the item's key, or index in the case of an array. The iteratee is
-passed a `callback(err)` which must be called once it has completed. If no
-error has occurred, the callback should be run without arguments or with an
-explicit `null` argument.
-* `callback(err)` - *Optional* A callback which is called when all `iteratee` functions have finished, or an error occurs.
-
-__Example__
-
-```js
-var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"};
-var configs = {};
-
-async.forEachOf(obj, function (value, key, callback) {
- fs.readFile(__dirname + value, "utf8", function (err, data) {
- if (err) return callback(err);
- try {
- configs[key] = JSON.parse(data);
- } catch (e) {
- return callback(e);
- }
- callback();
- });
-}, function (err) {
- if (err) console.error(err.message);
- // configs is now a map of JSON data
- doSomethingWith(configs);
-})
-```
-
-__Related__
-
-* forEachOfSeries(obj, iteratee, [callback])
-* forEachOfLimit(obj, limit, iteratee, [callback])
-
----------------------------------------
-
-<a name="map"></a>
-### map(arr, iteratee, [callback])
-
-Produces a new array of values by mapping each value in `arr` through
-the `iteratee` function. The `iteratee` is called with an item from `arr` and a
-callback for when it has finished processing. Each of these callback takes 2 arguments:
-an `error`, and the transformed item from `arr`. If `iteratee` passes an error to its
-callback, the main `callback` (for the `map` function) is immediately called with the error.
-
-Note, that since this function applies the `iteratee` to each item in parallel,
-there is no guarantee that the `iteratee` functions will complete in order.
-However, the results array will be in the same order as the original `arr`.
-
-__Arguments__
-
-* `arr` - An array to iterate over.
-* `iteratee(item, callback)` - A function to apply to each item in `arr`.
- The iteratee is passed a `callback(err, transformed)` which must be called once
- it has completed with an error (which can be `null`) and a transformed item.
-* `callback(err, results)` - *Optional* A callback which is called when all `iteratee`
- functions have finished, or an error occurs. Results is an array of the
- transformed items from the `arr`.
-
-__Example__
-
-```js
-async.map(['file1','file2','file3'], fs.stat, function(err, results){
- // results is now an array of stats for each file
-});
-```
-
-__Related__
-
-* mapSeries(arr, iteratee, [callback])
-* mapLimit(arr, limit, iteratee, [callback])
-
----------------------------------------
-
-<a name="select"></a>
-<a name="filter"></a>
-### filter(arr, iteratee, [callback])
-
-__Alias:__ `select`
-
-Returns a new array of all the values in `arr` which pass an async truth test.
-This operation is performed in parallel,
-but the results array will be in the same order as the original.
-
-__Arguments__
-
-* `arr` - An array to iterate over.
-* `iteratee(item, callback)` - A truth test to apply to each item in `arr`.
- The `iteratee` is passed a `callback(err, truthValue)`, which must be called with a
- boolean argument once it has completed.
-* `callback(err, results)` - *Optional* A callback which is called after all the `iteratee`
- functions have finished.
-
-__Example__
-
-```js
-async.filter(['file1','file2','file3'], function(filePath, callback) {
- fs.access(filePath, function(err) {
- callback(null, !err)
- });
-}, function(err, results){
- // results now equals an array of the existing files
-});
-```
-
-__Related__
-
-* filterSeries(arr, iteratee, [callback])
-* filterLimit(arr, limit, iteratee, [callback])
-
----------------------------------------
-
-<a name="reject"></a>
-### reject(arr, iteratee, [callback])
-
-The opposite of [`filter`](#filter). Removes values that pass an `async` truth test.
-
-__Related__
-
-* rejectSeries(arr, iteratee, [callback])
-* rejectLimit(arr, limit, iteratee, [callback])
-
----------------------------------------
-
-<a name="reduce"></a>
-### reduce(arr, memo, iteratee, [callback])
-
-__Aliases:__ `inject`, `foldl`
-
-Reduces `arr` into a single value using an async `iteratee` to return
-each successive step. `memo` is the initial state of the reduction.
-This function only operates in series.
-
-For performance reasons, it may make sense to split a call to this function into
-a parallel map, and then use the normal `Array.prototype.reduce` on the results.
-This function is for situations where each step in the reduction needs to be async;
-if you can get the data before reducing it, then it's probably a good idea to do so.
-
-__Arguments__
-
-* `arr` - An array to iterate over.
-* `memo` - The initial state of the reduction.
-* `iteratee(memo, item, callback)` - A function applied to each item in the
- array to produce the next step in the reduction. The `iteratee` is passed a
- `callback(err, reduction)` which accepts an optional error as its first
- argument, and the state of the reduction as the second. If an error is
- passed to the callback, the reduction is stopped and the main `callback` is
- immediately called with the error.
-* `callback(err, result)` - *Optional* A callback which is called after all the `iteratee`
- functions have finished. Result is the reduced value.
-
-__Example__
-
-```js
-async.reduce([1,2,3], 0, function(memo, item, callback){
- // pointless async:
- process.nextTick(function(){
- callback(null, memo + item)
- });
-}, function(err, result){
- // result is now equal to the last value of memo, which is 6
-});
-```
-
----------------------------------------
-
-<a name="reduceRight"></a>
-### reduceRight(arr, memo, iteratee, [callback])
-
-__Alias:__ `foldr`
-
-Same as [`reduce`](#reduce), only operates on `arr` in reverse order.
-
----------------------------------------
-
-<a name="detect"></a>
-### detect(arr, iteratee, [callback])
-
-Returns the first value in `arr` that passes an async truth test. The
-`iteratee` is applied in parallel, meaning the first iteratee to return `true` will
-fire the detect `callback` with that result. That means the result might not be
-the first item in the original `arr` (in terms of order) that passes the test.
-
-If order within the original `arr` is important, then look at `detectSeries`.
-
-__Arguments__
-
-* `arr` - An array to iterate over.
-* `iteratee(item, callback)` - A truth test to apply to each item in `arr`.
- The iteratee is passed a `callback(err, truthValue)` which must be called with a
- boolean argument once it has completed.
-* `callback(err, result)` - *Optional* A callback which is called as soon as any iteratee returns
- `true`, or after all the `iteratee` functions have finished. Result will be
- the first item in the array that passes the truth test (iteratee) or the
- value `undefined` if none passed.
-
-__Example__
-
-```js
-async.detect(['file1','file2','file3'], function(filePath, callback) {
- fs.access(filePath, function(err) {
- callback(null, !err)
- });
-}, function(err, result){
- // result now equals the first file in the list that exists
-});
-```
-
-__Related__
-
-* detectSeries(arr, iteratee, [callback])
-* detectLimit(arr, limit, iteratee, [callback])
-
----------------------------------------
-
-<a name="sortBy"></a>
-### sortBy(arr, iteratee, [callback])
-
-Sorts a list by the results of running each `arr` value through an async `iteratee`.
-
-__Arguments__
-
-* `arr` - An array to iterate over.
-* `iteratee(item, callback)` - A function to apply to each item in `arr`.
- The iteratee is passed a `callback(err, sortValue)` which must be called once it
- has completed with an error (which can be `null`) and a value to use as the sort
- criteria.
-* `callback(err, results)` - *Optional* A callback which is called after all the `iteratee`
- functions have finished, or an error occurs. Results is the items from
- the original `arr` sorted by the values returned by the `iteratee` calls.
-
-__Example__
-
-```js
-async.sortBy(['file1','file2','file3'], function(file, callback){
- fs.stat(file, function(err, stats){
- callback(err, stats.mtime);
- });
-}, function(err, results){
- // results is now the original array of files sorted by
- // modified date
-});
-```
-
-__Sort Order__
-
-By modifying the callback parameter the sorting order can be influenced:
-
-```js
-//ascending order
-async.sortBy([1,9,3,5], function(x, callback){
- callback(null, x);
-}, function(err,result){
- //result callback
-} );
-
-//descending order
-async.sortBy([1,9,3,5], function(x, callback){
- callback(null, x*-1); //<- x*-1 instead of x, turns the order around
-}, function(err,result){
- //result callback
-} );
-```
-
----------------------------------------
-
-<a name="some"></a>
-### some(arr, iteratee, [callback])
-
-__Alias:__ `any`
-
-Returns `true` if at least one element in the `arr` satisfies an async test.
-If any iteratee call returns `true`, the main `callback` is immediately called.
-
-__Arguments__
-
-* `arr` - An array to iterate over.
-* `iteratee(item, callback)` - A truth test to apply to each item in the array
- in parallel. The iteratee is passed a `callback(truthValue)`` which must be
- called with a boolean argument once it has completed.
-* `callback(err, result)` - *Optional* A callback which is called as soon as any iteratee returns
- `true`, or after all the iteratee functions have finished. Result will be
- either `true` or `false` depending on the values of the async tests.
-
-__Example__
-
-```js
-async.some(['file1','file2','file3'], function(filePath, callback) {
- fs.access(filePath, function(err) {
- callback(null, !err)
- });
-}, function(err, result){
- // if result is true then at least one of the files exists
-});
-```
-
-__Related__
-
-* someLimit(arr, limit, iteratee, callback)
-
----------------------------------------
-
-<a name="every"></a>
-### every(arr, iteratee, [callback])
-
-__Alias:__ `all`
-
-Returns `true` if every element in `arr` satisfies an async test.
-If any iteratee call returns `false`, the main `callback` is immediately called.
-
-__Arguments__
-
-* `arr` - An array to iterate over.
-* `iteratee(item, callback)` - A truth test to apply to each item in the array
- in parallel. The iteratee is passed a `callback(err, truthValue)` which must be
- called with a boolean argument once it has completed.
-* `callback(err, result)` - *Optional* A callback which is called after all the `iteratee`
- functions have finished. Result will be either `true` or `false` depending on
- the values of the async tests.
-
-__Example__
-
-```js
-async.every(['file1','file2','file3'], function(filePath, callback) {
- fs.access(filePath, function(err) {
- callback(null, !err)
- });
-}, function(err, result){
- // if result is true then every file exists
-});
-```
-
-__Related__
-
-* everyLimit(arr, limit, iteratee, callback)
-
----------------------------------------
-
-<a name="concat"></a>
-### concat(arr, iteratee, [callback])
-
-Applies `iteratee` to each item in `arr`, concatenating the results. Returns the
-concatenated list. The `iteratee`s are called in parallel, and the results are
-concatenated as they return. There is no guarantee that the results array will
-be returned in the original order of `arr` passed to the `iteratee` function.
-
-__Arguments__
-
-* `arr` - An array to iterate over.
-* `iteratee(item, callback)` - A function to apply to each item in `arr`.
- The iteratee is passed a `callback(err, results)` which must be called once it
- has completed with an error (which can be `null`) and an array of results.
-* `callback(err, results)` - *Optional* A callback which is called after all the `iteratee`
- functions have finished, or an error occurs. Results is an array containing
- the concatenated results of the `iteratee` function.
-
-__Example__
-
-```js
-async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){
- // files is now a list of filenames that exist in the 3 directories
-});
-```
-
-__Related__
-
-* concatSeries(arr, iteratee, [callback])
-
-
-## Control Flow
-
-<a name="series"></a>
-### series(tasks, [callback])
-
-Run the functions in the `tasks` array in series, each one running once the previous
-function has completed. If any functions in the series pass an error to its
-callback, no more functions are run, and `callback` is immediately called with the value of the error.
-Otherwise, `callback` receives an array of results when `tasks` have completed.
-
-It is also possible to use an object instead of an array. Each property will be
-run as a function, and the results will be passed to the final `callback` as an object
-instead of an array. This can be a more readable way of handling results from
-[`series`](#series).
-
-**Note** that while many implementations preserve the order of object properties, the
-[ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6)
-explicitly states that
-
-> The mechanics and order of enumerating the properties is not specified.
-
-So if you rely on the order in which your series of functions are executed, and want
-this to work on all platforms, consider using an array.
-
-__Arguments__
-
-* `tasks` - An array or object 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.
-* `callback(err, results)` - An optional callback to run once all the functions
- have completed. This function gets a results array (or object) containing all
- the result arguments passed to the `task` callbacks.
-
-__Example__
-
-```js
-async.series([
- function(callback){
- // do some stuff ...
- callback(null, 'one');
- },
- function(callback){
- // do some more stuff ...
- callback(null, 'two');
- }
-],
-// optional callback
-function(err, results){
- // results is now equal to ['one', 'two']
-});
-
-
-// an example using an object instead of an array
-async.series({
- one: function(callback){
- setTimeout(function(){
- callback(null, 1);
- }, 200);
- },
- two: function(callback){
- setTimeout(function(){
- callback(null, 2);
- }, 100);
- }
-},
-function(err, results) {
- // results is now equal to: {one: 1, two: 2}
-});
-```
-
----------------------------------------
-
-<a name="parallel"></a>
-### parallel(tasks, [callback])
-
-Run the `tasks` array of functions in parallel, without waiting until the previous
-function has completed. If any of the functions pass an error to its
-callback, the main `callback` is immediately called with the value of the error.
-Once the `tasks` have completed, the results are passed to the final `callback` as an
-array.
-
-**Note:** `parallel` is about kicking-off I/O tasks in parallel, not about parallel execution of code. If your tasks do not use any timers or perform any I/O, they will actually be executed in series. Any synchronous setup sections for each task will happen one after the other. JavaScript remains single-threaded.
-
-It is also possible to use an object instead of an array. Each property will be
-run as a function and the results will be passed to the final `callback` as an object
-instead of an array. This can be a more readable way of handling results from
-[`parallel`](#parallel).
-
-
-__Arguments__
-
-* `tasks` - An array or object containing functions to run. Each function is passed
- a `callback(err, result)` which it must call on completion with an error `err`
- (which can be `null`) and an optional `result` value.
-* `callback(err, results)` - An optional callback to run once all the functions
- have completed successfully. This function gets a results array (or object) containing all
- the result arguments passed to the task callbacks.
-
-__Example__
-
-```js
-async.parallel([
- function(callback){
- setTimeout(function(){
- callback(null, 'one');
- }, 200);
- },
- function(callback){
- setTimeout(function(){
- callback(null, 'two');
- }, 100);
- }
-],
-// optional callback
-function(err, results){
- // the results array will equal ['one','two'] even though
- // the second function had a shorter timeout.
-});
-
-
-// an example using an object instead of an array
-async.parallel({
- one: function(callback){
- setTimeout(function(){
- callback(null, 1);
- }, 200);
- },
- two: function(callback){
- setTimeout(function(){
- callback(null, 2);
- }, 100);
- }
-},
-function(err, results) {
- // results is now equals to: {one: 1, two: 2}
-});
-```
-
-__Related__
-
-* parallelLimit(tasks, limit, [callback])
-
----------------------------------------
-
-<a name="whilst"></a>
-### whilst(test, fn, callback)
-
-Repeatedly call `fn`, while `test` returns `true`. Calls `callback` when stopped,
-or an error occurs.
-
-__Arguments__
-
-* `test()` - synchronous truth test to perform before each execution of `fn`.
-* `fn(callback)` - A function which is called each time `test` passes. The function is
- passed a `callback(err)`, which must be called once it has completed with an
- optional `err` argument.
-* `callback(err, [results])` - A callback which is called after the test
- function has failed and repeated execution of `fn` has stopped. `callback`
- will be passed an error and any arguments passed to the final `fn`'s callback.
-
-__Example__
-
-```js
-var count = 0;
-
-async.whilst(
- function () { return count < 5; },
- function (callback) {
- count++;
- setTimeout(function () {
- callback(null, count);
- }, 1000);
- },
- function (err, n) {
- // 5 seconds have passed, n = 5
- }
-);
-```
-
----------------------------------------
-
-<a name="doWhilst"></a>
-### doWhilst(fn, test, callback)
-
-The post-check version of [`whilst`](#whilst). To reflect the difference in
-the order of operations, the arguments `test` and `fn` are switched.
-
-`doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.
-
----------------------------------------
-
-<a name="until"></a>
-### until(test, fn, callback)
-
-Repeatedly call `fn` until `test` returns `true`. Calls `callback` when stopped,
-or an error occurs. `callback` will be passed an error and any arguments passed
-to the final `fn`'s callback.
-
-The inverse of [`whilst`](#whilst).
-
----------------------------------------
-
-<a name="doUntil"></a>
-### doUntil(fn, test, callback)
-
-Like [`doWhilst`](#doWhilst), except the `test` is inverted. Note the argument ordering differs from `until`.
-
----------------------------------------
-
-<a name="during"></a>
-### during(test, fn, callback)
-
-Like [`whilst`](#whilst), except the `test` is an asynchronous function that is passed a callback in the form of `function (err, truth)`. If error is passed to `test` or `fn`, the main callback is immediately called with the value of the error.
-
-__Example__
-
-```js
-var count = 0;
-
-async.during(
- function (callback) {
- return callback(null, count < 5);
- },
- function (callback) {
- count++;
- setTimeout(callback, 1000);
- },
- function (err) {
- // 5 seconds have passed
- }
-);
-```
-
----------------------------------------
-
-<a name="doDuring"></a>
-### doDuring(fn, test, callback)
-
-The post-check version of [`during`](#during). To reflect the difference in
-the order of operations, the arguments `test` and `fn` are switched.
-
-Also a version of [`doWhilst`](#doWhilst) with asynchronous `test` function.
-
----------------------------------------
-
-<a name="forever"></a>
-### forever(fn, [errback])
-
-Calls the asynchronous function `fn` with a callback parameter that allows it to
-call itself again, in series, indefinitely.
-
-If an error is passed to the callback then `errback` is called with the
-error, and execution stops, otherwise it will never be called.
-
-```js
-async.forever(
- function(next) {
- // next is suitable for passing to things that need a callback(err [, whatever]);
- // it will result in this function being called again.
- },
- function(err) {
- // if next is called with a value in its first parameter, it will appear
- // in here as 'err', and execution will stop.
- }
-);
-```
-
----------------------------------------
-
-<a name="waterfall"></a>
-### waterfall(tasks, [callback])
-
-Runs the `tasks` array of functions in series, each passing their results to the next in
-the array. However, if any of the `tasks` pass an error to their own callback, the
-next function is not executed, and the main `callback` is immediately called with
-the error.
-
-__Arguments__
-
-* `tasks` - An array of functions to run, each function is passed a
- `callback(err, result1, result2, ...)` it must call on completion. The first
- argument is an error (which can be `null`) and any further arguments will be
- passed as arguments in order to the next task.
-* `callback(err, [results])` - An optional callback to run once all the functions
- have completed. This will be passed the results of the last task's callback.
-
-
-
-__Example__
-
-```js
-async.waterfall([
- function(callback) {
- callback(null, 'one', 'two');
- },
- function(arg1, arg2, callback) {
- // arg1 now equals 'one' and arg2 now equals 'two'
- callback(null, 'three');
- },
- function(arg1, callback) {
- // arg1 now equals 'three'
- callback(null, 'done');
- }
-], function (err, result) {
- // result now equals 'done'
-});
-```
-Or, with named functions:
-
-```js
-async.waterfall([
- myFirstFunction,
- mySecondFunction,
- myLastFunction,
-], function (err, result) {
- // result now equals 'done'
-});
-function myFirstFunction(callback) {
- callback(null, 'one', 'two');
-}
-function mySecondFunction(arg1, arg2, callback) {
- // arg1 now equals 'one' and arg2 now equals 'two'
- callback(null, 'three');
-}
-function myLastFunction(arg1, callback) {
- // arg1 now equals 'three'
- callback(null, 'done');
-}
-```
-
-Or, if you need to pass any argument to the first function:
-
-```js
-async.waterfall([
- async.apply(myFirstFunction, 'zero'),
- mySecondFunction,
- myLastFunction,
-], function (err, result) {
- // result now equals 'done'
-});
-function myFirstFunction(arg1, callback) {
- // arg1 now equals 'zero'
- callback(null, 'one', 'two');
-}
-function mySecondFunction(arg1, arg2, callback) {
- // arg1 now equals 'one' and arg2 now equals 'two'
- callback(null, 'three');
-}
-function myLastFunction(arg1, callback) {
- // arg1 now equals 'three'
- callback(null, 'done');
-}
-```
-
----------------------------------------
-
-<a name="compose"></a>
-### compose(fn1, fn2...)
-
-Creates a function which is a composition of the passed asynchronous
-functions. Each function consumes the return value of the function that
-follows. Composing functions `f()`, `g()`, and `h()` would produce the result of
-`f(g(h()))`, only this version uses callbacks to obtain the return values.
-
-Each function is executed with the `this` binding of the composed function.
-
-__Arguments__
-
-* `functions...` - the asynchronous functions to compose
-
-
-__Example__
-
-```js
-function add1(n, callback) {
- setTimeout(function () {
- callback(null, n + 1);
- }, 10);
-}
-
-function mul3(n, callback) {
- setTimeout(function () {
- callback(null, n * 3);
- }, 10);
-}
-
-var add1mul3 = async.compose(mul3, add1);
-
-add1mul3(4, function (err, result) {
- // result now equals 15
-});
-```
-
----------------------------------------
-
-<a name="seq"></a>
-### seq(fn1, fn2...)
-
-Version of the compose function that is more natural to read.
-Each function consumes the return value of the previous function.
-It is the equivalent of [`compose`](#compose) with the arguments reversed.
-
-Each function is executed with the `this` binding of the composed function.
-
-__Arguments__
-
-* `functions...` - the asynchronous functions to compose
-
-
-__Example__
-
-```js
-// Requires lodash (or underscore), express3 and dresende's orm2.
-// Part of an app, that fetches cats of the logged user.
-// This example uses `seq` function to avoid overnesting and error
-// handling clutter.
-app.get('/cats', function(request, response) {
- var User = request.models.User;
- async.seq(
- _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data))
- function(user, fn) {
- user.getCats(fn); // 'getCats' has signature (callback(err, data))
- }
- )(req.session.user_id, function (err, cats) {
- if (err) {
- console.error(err);
- response.json({ status: 'error', message: err.message });
- } else {
- response.json({ status: 'ok', message: 'Cats found', data: cats });
- }
- });
-});
-```
-
----------------------------------------
-
-<a name="applyEach"></a>
-### applyEach(fns, args..., callback)
-
-Applies the provided arguments to each function in the array, calling
-`callback` after all functions have completed. If you only provide the first
-argument, then it will return a function which lets you pass in the
-arguments as if it were a single function call.
-
-__Arguments__
-
-* `fns` - the asynchronous functions to all call with the same arguments
-* `args...` - any number of separate arguments to pass to the function
-* `callback` - the final argument should be the callback, called when all
- functions have completed processing
-
-
-__Example__
-
-```js
-async.applyEach([enableSearch, updateSchema], 'bucket', callback);
-
-// partial application example:
-async.each(
- buckets,
- async.applyEach([enableSearch, updateSchema]),
- callback
-);
-```
-
-__Related__
-
-* applyEachSeries(tasks, args..., [callback])
-
----------------------------------------
-
-<a name="queue"></a>
-### queue(worker, [concurrency])
-
-Creates a `queue` object with the specified `concurrency`. Tasks added to the
-`queue` are processed in parallel (up to the `concurrency` limit). If all
-`worker`s are in progress, the task is queued until one becomes available.
-Once a `worker` completes a `task`, that `task`'s callback is called.
-
-__Arguments__
-
-* `worker(task, callback)` - An asynchronous function for processing a queued
- task, which must call its `callback(err)` argument when finished, with an
- optional `error` as an argument. If you want to handle errors from an individual task, pass a callback to `q.push()`.
-* `concurrency` - An `integer` for determining how many `worker` functions should be
- run in parallel. If omitted, the concurrency defaults to `1`. If the concurrency is `0`, an error is thrown.
-
-__Queue objects__
-
-The `queue` object returned by this function has the following properties and
-methods:
-
-* `length()` - a function returning the number of items waiting to be processed.
-* `started` - a function returning whether or not any items have been pushed and processed by the queue
-* `running()` - a function returning the number of items currently being processed.
-* `workersList()` - a function returning the array of items currently being processed.
-* `idle()` - a function returning false if there are items waiting or being processed, or true if not.
-* `concurrency` - an integer for determining how many `worker` functions should be
- run in parallel. This property can be changed after a `queue` is created to
- alter the concurrency on-the-fly.
-* `push(task, [callback])` - add a new task to the `queue`. Calls `callback` once
- the `worker` has finished processing the task. Instead of a single task, a `tasks` array
- can be submitted. The respective callback is used for every task in the list.
-* `unshift(task, [callback])` - add a new task to the front of the `queue`.
-* `saturated` - a callback that is called when the `queue` length hits the `concurrency` limit,
- and further tasks will be queued.
-* `empty` - a callback that is called when the last item from the `queue` is given to a `worker`.
-* `drain` - a callback that is called when the last item from the `queue` has returned from the `worker`.
-* `paused` - a boolean for determining whether the queue is in a paused state
-* `pause()` - a function that pauses the processing of tasks until `resume()` is called.
-* `resume()` - a function that resumes the processing of queued tasks when the queue is paused.
-* `kill()` - a function that removes the `drain` callback and empties remaining tasks from the queue forcing it to go idle.
-
-__Example__
-
-```js
-// create a queue object with concurrency 2
-
-var q = async.queue(function (task, callback) {
- console.log('hello ' + task.name);
- callback();
-}, 2);
-
-
-// assign a callback
-q.drain = function() {
- console.log('all items have been processed');
-}
-
-// add some items to the queue
-
-q.push({name: 'foo'}, function (err) {
- console.log('finished processing foo');
-});
-q.push({name: 'bar'}, function (err) {
- console.log('finished processing bar');
-});
-
-// add some items to the queue (batch-wise)
-
-q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) {
- console.log('finished processing item');
-});
-
-// add some items to the front of the queue
-
-q.unshift({name: 'bar'}, function (err) {
- console.log('finished processing bar');
-});
-```
-
----------------------------------------
-
-<a name="priorityQueue"></a>
-### priorityQueue(worker, concurrency)
-
-The same as [`queue`](#queue) only tasks are assigned a priority and completed in ascending priority order. There are two differences between `queue` and `priorityQueue` objects:
-
-* `push(task, priority, [callback])` - `priority` should be a number. If an array of
- `tasks` is given, all tasks will be assigned the same priority.
-* The `unshift` method was removed.
-
----------------------------------------
-
-<a name="cargo"></a>
-### cargo(worker, [payload])
-
-Creates a `cargo` object with the specified payload. Tasks added to the
-cargo will be processed altogether (up to the `payload` limit). If the
-`worker` is in progress, the task is queued until it becomes available. Once
-the `worker` has completed some tasks, each callback of those tasks is called.
-Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966) for how `cargo` and `queue` work.
-
-While [queue](#queue) passes only one task to one of a group of workers
-at a time, cargo passes an array of tasks to a single worker, repeating
-when the worker is finished.
-
-__Arguments__
-
-* `worker(tasks, callback)` - An asynchronous function for processing an array of
- queued tasks, which must call its `callback(err)` argument when finished, with
- an optional `err` argument.
-* `payload` - An optional `integer` for determining how many tasks should be
- processed per round; if omitted, the default is unlimited.
-
-__Cargo objects__
-
-The `cargo` object returned by this function has the following properties and
-methods:
-
-* `length()` - A function returning the number of items waiting to be processed.
-* `payload` - An `integer` for determining how many tasks should be
- process per round. This property can be changed after a `cargo` is created to
- alter the payload on-the-fly.
-* `push(task, [callback])` - Adds `task` to the `queue`. The callback is called
- once the `worker` has finished processing the task. Instead of a single task, an array of `tasks`
- can be submitted. The respective callback is used for every task in the list.
-* `saturated` - A callback that is called when the `queue.length()` hits the concurrency and further tasks will be queued.
-* `empty` - A callback that is called when the last item from the `queue` is given to a `worker`.
-* `drain` - A callback that is called when the last item from the `queue` has returned from the `worker`.
-* `idle()`, `pause()`, `resume()`, `kill()` - cargo inherits all of the same methods and event calbacks as [`queue`](#queue)
-
-__Example__
-
-```js
-// create a cargo object with payload 2
-
-var cargo = async.cargo(function (tasks, callback) {
- for(var i=0; i<tasks.length; i++){
- console.log('hello ' + tasks[i].name);
- }
- callback();
-}, 2);
-
-
-// add some items
-
-cargo.push({name: 'foo'}, function (err) {
- console.log('finished processing foo');
-});
-cargo.push({name: 'bar'}, function (err) {
- console.log('finished processing bar');
-});
-cargo.push({name: 'baz'}, function (err) {
- console.log('finished processing baz');
-});
-```
-
----------------------------------------
-
-<a name="auto"></a>
-### auto(tasks, [concurrency], [callback])
-
-Determines the best order for running the functions in `tasks`, based on their requirements. Each function can optionally depend on other functions being completed first, and each function is run as soon as its requirements are satisfied.
-
-If any of the functions pass an error to their callback, the `auto` sequence will stop. Further tasks will not execute (so any other functions depending on it will not run), and the main `callback` is immediately called with the error. Functions also receive an object containing the results of functions which have completed so far.
-
-Note, all functions are called with a `results` object as a second argument,
-so it is unsafe to pass functions in the `tasks` object which cannot handle the
-extra argument.
-
-For example, this snippet of code:
-
-```js
-async.auto({
- readData: async.apply(fs.readFile, 'data.txt', 'utf-8')
-}, callback);
-```
-
-will have the effect of calling `readFile` with the results object as the last
-argument, which will fail:
-
-```js
-fs.readFile('data.txt', 'utf-8', cb, {});
-```
-
-Instead, wrap the call to `readFile` in a function which does not forward the
-`results` object:
-
-```js
-async.auto({
- readData: function(cb, results){
- fs.readFile('data.txt', 'utf-8', cb);
- }
-}, callback);
-```
-
-__Arguments__
-
-* `tasks` - An object. Each of its properties is either a function or an array of
- requirements, with the function itself the last item in the array. The object's key
- of a property serves as the name of the task defined by that property,
- i.e. can be used when specifying requirements for other tasks.
- The function receives two arguments: (1) a `callback(err, result)` which must be
- called when finished, passing an `error` (which can be `null`) and the result of
- the function's execution, and (2) a `results` object, containing the results of
- the previously executed functions.
-* `concurrency` - An optional `integer` for determining the maximum number of tasks that can be run in parallel. By default, as many as possible.
-* `callback(err, results)` - An optional callback which is called when all the
- tasks have been completed. It receives the `err` argument if any `tasks`
- pass an error to their callback. Results are always returned; however, if
- an error occurs, no further `tasks` will be performed, and the results
- object will only contain partial results.
-
-__Example__
-
-```js
-async.auto({
- get_data: function(callback){
- console.log('in get_data');
- // async code to get some data
- callback(null, 'data', 'converted to array');
- },
- make_folder: function(callback){
- console.log('in make_folder');
- // async code to create a directory to store a file in
- // this is run at the same time as getting the data
- callback(null, 'folder');
- },
- write_file: ['get_data', 'make_folder', function(callback, results){
- console.log('in write_file', JSON.stringify(results));
- // once there is some data and the directory exists,
- // write the data to a file in the directory
- callback(null, 'filename');
- }],
- email_link: ['write_file', function(callback, results){
- console.log('in email_link', JSON.stringify(results));
- // once the file is written let's email a link to it...
- // results.write_file contains the filename returned by write_file.
- callback(null, {'file':results.write_file, 'email':'user@example.com'});
- }]
-}, function(err, results) {
- console.log('err = ', err);
- console.log('results = ', results);
-});
-```
-
-This is a fairly trivial example, but to do this using the basic parallel and
-series functions would look like this:
-
-```js
-async.parallel([
- function(callback){
- console.log('in get_data');
- // async code to get some data
- callback(null, 'data', 'converted to array');
- },
- function(callback){
- console.log('in make_folder');
- // async code to create a directory to store a file in
- // this is run at the same time as getting the data
- callback(null, 'folder');
- }
-],
-function(err, results){
- async.series([
- function(callback){
- console.log('in write_file', JSON.stringify(results));
- // once there is some data and the directory exists,
- // write the data to a file in the directory
- results.push('filename');
- callback(null);
- },
- function(callback){
- console.log('in email_link', JSON.stringify(results));
- // once the file is written let's email a link to it...
- callback(null, {'file':results.pop(), 'email':'user@example.com'});
- }
- ]);
-});
-```
-
-For a complicated series of `async` tasks, using the [`auto`](#auto) function makes adding
-new tasks much easier (and the code more readable).
-
----------------------------------------
-
-<a name="retry"></a>
-### retry([opts = {times: 5, interval: 0}| 5], task, [callback])
-
-Attempts to get a successful response from `task` no more than `times` times before
-returning an error. If the task is successful, the `callback` will be passed the result
-of the successful task. If all attempts fail, the callback will be passed the error and
-result (if any) of the final attempt.
-
-__Arguments__
-
-* `opts` - Can be either an object with `times` and `interval` or a number.
- * `times` - The number of attempts to make before giving up. The default is `5`.
- * `interval` - The time to wait between retries, in milliseconds. The default is `0`.
- * If `opts` is a number, the number specifies the number of times to retry, with the default interval of `0`.
-* `task(callback, results)` - A function which receives two arguments: (1) a `callback(err, result)`
- which must be called when finished, passing `err` (which can be `null`) and the `result` of
- the function's execution, and (2) a `results` object, containing the results of
- the previously executed functions (if nested inside another control flow).
-* `callback(err, results)` - An optional callback which is called when the
- task has succeeded, or after the final failed attempt. It receives the `err` and `result` arguments of the last attempt at completing the `task`.
-
-The [`retry`](#retry) function can be used as a stand-alone control flow by passing a callback, as shown below:
-
-```js
-// try calling apiMethod 3 times
-async.retry(3, apiMethod, function(err, result) {
- // do something with the result
-});
-```
-
-```js
-// try calling apiMethod 3 times, waiting 200 ms between each retry
-async.retry({times: 3, interval: 200}, apiMethod, function(err, result) {
- // do something with the result
-});
-```
-
-```js
-// try calling apiMethod the default 5 times no delay between each retry
-async.retry(apiMethod, function(err, result) {
- // do something with the result
-});
-```
-
-It can also be embedded within other control flow functions to retry individual methods
-that are not as reliable, like this:
-
-```js
-async.auto({
- users: api.getUsers.bind(api),
- payments: async.retry(3, api.getPayments.bind(api))
-}, function(err, results) {
- // do something with the results
-});
-```
-
----------------------------------------
-
-<a name="iterator"></a>
-### iterator(tasks)
-
-Creates an iterator function which calls the next function in the `tasks` array,
-returning a continuation to call the next one after that. It's also possible to
-“peek” at the next iterator with `iterator.next()`.
-
-This function is used internally by the `async` module, but can be useful when
-you want to manually control the flow of functions in series.
-
-__Arguments__
-
-* `tasks` - An array of functions to run.
-
-__Example__
-
-```js
-var iterator = async.iterator([
- function(){ sys.p('one'); },
- function(){ sys.p('two'); },
- function(){ sys.p('three'); }
-]);
-
-node> var iterator2 = iterator();
-'one'
-node> var iterator3 = iterator2();
-'two'
-node> iterator3();
-'three'
-node> var nextfn = iterator2.next();
-node> nextfn();
-'three'
-```
-
-## Utils
-
-<a name="apply"></a>
-### apply(function, arguments..)
-
-Creates a continuation function with some arguments already applied.
-
-Useful as a shorthand when combined with other control flow functions. Any arguments
-passed to the returned function are added to the arguments originally passed
-to apply.
-
-__Arguments__
-
-* `function` - The function you want to eventually apply all arguments to.
-* `arguments...` - Any number of arguments to automatically apply when the
- continuation is called.
-
-__Example__
-
-```js
-// using apply
-
-async.parallel([
- async.apply(fs.writeFile, 'testfile1', 'test1'),
- async.apply(fs.writeFile, 'testfile2', 'test2'),
-]);
-
-
-// the same process without using apply
-
-async.parallel([
- function(callback){
- fs.writeFile('testfile1', 'test1', callback);
- },
- function(callback){
- fs.writeFile('testfile2', 'test2', callback);
- }
-]);
-```
-
-It's possible to pass any number of additional arguments when calling the
-continuation:
-
-```js
-node> var fn = async.apply(sys.puts, 'one');
-node> fn('two', 'three');
-one
-two
-three
-```
-
----------------------------------------
-
-<a name="nextTick"></a>
-### nextTick(callback), setImmediate(callback)
-
-Calls `callback` on a later loop around the event loop. In Node.js this just
-calls `process.nextTick`; in the browser it falls back to `setImmediate(callback)`
-if available, otherwise `setTimeout(callback, 0)`, which means other higher priority
-events may precede the execution of `callback`.
-
-This is used internally for browser-compatibility purposes.
-
-__Arguments__
-
-* `callback` - The function to call on a later loop around the event loop.
-
-__Example__
-
-```js
-var call_order = [];
-async.nextTick(function(){
- call_order.push('two');
- // call_order now equals ['one','two']
-});
-call_order.push('one')
-```
-
----------------------------------------
-
-<a name="times"></a>
-### times(n, iteratee, [callback])
-
-Calls the `iteratee` function `n` times, and accumulates results in the same manner
-you would use with [`map`](#map).
-
-__Arguments__
-
-* `n` - The number of times to run the function.
-* `iteratee` - The function to call `n` times.
-* `callback` - see [`map`](#map)
-
-__Example__
-
-```js
-// Pretend this is some complicated async factory
-var createUser = function(id, callback) {
- callback(null, {
- id: 'user' + id
- })
-}
-// generate 5 users
-async.times(5, function(n, next){
- createUser(n, function(err, user) {
- next(err, user)
- })
-}, function(err, users) {
- // we should now have 5 users
-});
-```
-
-__Related__
-
-* timesSeries(n, iteratee, [callback])
-* timesLimit(n, limit, iteratee, [callback])
-
----------------------------------------
-
-<a name="memoize"></a>
-### memoize(fn, [hasher])
-
-Caches the results of an `async` function. When creating a hash to store function
-results against, the callback is omitted from the hash and an optional hash
-function can be used.
-
-If no hash function is specified, the first argument is used as a hash key, which may work reasonably if it is a string or a data type that converts to a distinct string. Note that objects and arrays will not behave reasonably. Neither will cases where the other arguments are significant. In such cases, specify your own hash function.
-
-The cache of results is exposed as the `memo` property of the function returned
-by `memoize`.
-
-__Arguments__
-
-* `fn` - The function to proxy and cache results from.
-* `hasher` - An optional function for generating a custom hash for storing
- results. It has all the arguments applied to it apart from the callback, and
- must be synchronous.
-
-__Example__
-
-```js
-var slow_fn = function (name, callback) {
- // do something
- callback(null, result);
-};
-var fn = async.memoize(slow_fn);
-
-// fn can now be used as if it were slow_fn
-fn('some name', function () {
- // callback
-});
-```
-
----------------------------------------
-
-<a name="unmemoize"></a>
-### unmemoize(fn)
-
-Undoes a [`memoize`](#memoize)d function, reverting it to the original, unmemoized
-form. Handy for testing.
-
-__Arguments__
-
-* `fn` - the memoized function
-
----------------------------------------
-
-<a name="ensureAsync"></a>
-### ensureAsync(fn)
-
-Wrap an async function and ensure it calls its callback on a later tick of the event loop. If the function already calls its callback on a next tick, no extra deferral is added. This is useful for preventing stack overflows (`RangeError: Maximum call stack size exceeded`) and generally keeping [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony) contained.
-
-__Arguments__
-
-* `fn` - an async function, one that expects a node-style callback as its last argument
-
-Returns a wrapped function with the exact same call signature as the function passed in.
-
-__Example__
-
-```js
-function sometimesAsync(arg, callback) {
- if (cache[arg]) {
- return callback(null, cache[arg]); // this would be synchronous!!
- } else {
- doSomeIO(arg, callback); // this IO would be asynchronous
- }
-}
-
-// this has a risk of stack overflows if many results are cached in a row
-async.mapSeries(args, sometimesAsync, done);
-
-// this will defer sometimesAsync's callback if necessary,
-// preventing stack overflows
-async.mapSeries(args, async.ensureAsync(sometimesAsync), done);
-
-```
-
----------------------------------------
-
-<a name="constant"></a>
-### constant(values...)
-
-Returns a function that when called, calls-back with the values provided. Useful as the first function in a `waterfall`, or for plugging values in to `auto`.
-
-__Example__
-
-```js
-async.waterfall([
- async.constant(42),
- function (value, next) {
- // value === 42
- },
- //...
-], callback);
-
-async.waterfall([
- async.constant(filename, "utf8"),
- fs.readFile,
- function (fileData, next) {
- //...
- }
- //...
-], callback);
-
-async.auto({
- hostname: async.constant("https://server.net/"),
- port: findFreePort,
- launchServer: ["hostname", "port", function (cb, options) {
- startServer(options, cb);
- }],
- //...
-}, callback);
-
-```
-
----------------------------------------
-
-<a name="asyncify"></a>
-<a name="wrapSync"></a>
-### asyncify(func)
-
-__Alias:__ `wrapSync`
-
-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, series, or other async functions. Any arguments passed to the generated function will be passed to the wrapped function (except for the final callback argument). Errors thrown will be passed to the callback.
-
-__Example__
-
-```js
-async.waterfall([
- async.apply(fs.readFile, filename, "utf8"),
- async.asyncify(JSON.parse),
- function (data, next) {
- // data is the result of parsing the text.
- // If there was a parsing error, it would have been caught.
- }
-], callback)
-```
-
-If the function passed to `asyncify` returns a Promise, that promises's resolved/rejected state will be used to call the callback, rather than simply the synchronous return value. Example:
-
-```js
-async.waterfall([
- async.apply(fs.readFile, filename, "utf8"),
- async.asyncify(function (contents) {
- return db.model.create(contents);
- }),
- function (model, next) {
- // `model` is the instantiated model object.
- // If there was an error, this function would be skipped.
- }
-], callback)
-```
-
-This also means you can asyncify ES2016 `async` functions.
-
-```js
-var q = async.queue(async.asyncify(async function (file) {
- var intermediateStep = await processFile(file);
- return await somePromise(intermediateStep)
-}));
-
-q.push(files);
-```
-
----------------------------------------
-
-<a name="log"></a>
-### log(function, arguments)
-
-Logs the result of an `async` function to the `console`. Only works in Node.js or
-in browsers that support `console.log` and `console.error` (such as FF and Chrome).
-If multiple arguments are returned from the async function, `console.log` is
-called on each argument in order.
-
-__Arguments__
-
-* `function` - The function you want to eventually apply all arguments to.
-* `arguments...` - Any number of arguments to apply to the function.
-
-__Example__
-
-```js
-var hello = function(name, callback){
- setTimeout(function(){
- callback(null, 'hello ' + name);
- }, 1000);
-};
-```
-```js
-node> async.log(hello, 'world');
-'hello world'
-```
-
----------------------------------------
-
-<a name="dir"></a>
-### dir(function, arguments)
-
-Logs the result of an `async` function to the `console` using `console.dir` to
-display the properties of the resulting object. Only works in Node.js or
-in browsers that support `console.dir` and `console.error` (such as FF and Chrome).
-If multiple arguments are returned from the async function, `console.dir` is
-called on each argument in order.
-
-__Arguments__
-
-* `function` - The function you want to eventually apply all arguments to.
-* `arguments...` - Any number of arguments to apply to the function.
-
-__Example__
-
-```js
-var hello = function(name, callback){
- setTimeout(function(){
- callback(null, {hello: name});
- }, 1000);
-};
-```
-```js
-node> async.dir(hello, 'world');
-{hello: 'world'}
-```
-
----------------------------------------
-
-<a name="noConflict"></a>
-### noConflict()
-
-Changes the value of `async` back to its original value, returning a reference to the
-`async` object.
diff --git a/build-es/apply.js b/build-es/apply.js
deleted file mode 100644
index eeceb43..0000000
--- a/build-es/apply.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import rest from 'lodash-es/rest';
-
-export default rest(function(fn, args) {
- return rest(function(callArgs) {
- return fn.apply(null, args.concat(callArgs));
- });
-});
diff --git a/build-es/applyEach.js b/build-es/applyEach.js
deleted file mode 100644
index 2c5f001..0000000
--- a/build-es/applyEach.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import applyEach from './internal/applyEach';
-import eachOf from './eachOf';
-
-export default applyEach(eachOf);
diff --git a/build-es/applyEachSeries.js b/build-es/applyEachSeries.js
deleted file mode 100644
index e917618..0000000
--- a/build-es/applyEachSeries.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import applyEach from './internal/applyEach';
-import eachOfSeries from './eachOfSeries';
-
-export default applyEach(eachOfSeries);
diff --git a/build-es/asyncify.js b/build-es/asyncify.js
deleted file mode 100644
index 9239e99..0000000
--- a/build-es/asyncify.js
+++ /dev/null
@@ -1,26 +0,0 @@
-'use strict';
-
-import isObject from 'lodash-es/isObject';
-import rest from 'lodash-es/rest';
-
-export default function asyncify(func) {
- return rest(function (args) {
- var callback = args.pop();
- var result;
- try {
- result = func.apply(this, args);
- } catch (e) {
- return callback(e);
- }
- // if result is Promise object
- if (isObject(result) && typeof result.then === 'function') {
- result.then(function(value) {
- callback(null, value);
- })['catch'](function(err) {
- callback(err.message ? err : new Error(err));
- });
- } else {
- callback(null, result);
- }
- });
-}
diff --git a/build-es/auto.js b/build-es/auto.js
deleted file mode 100644
index ad5d081..0000000
--- a/build-es/auto.js
+++ /dev/null
@@ -1,114 +0,0 @@
-'use strict';
-
-import arrayEach from 'lodash-es/_arrayEach';
-import arrayEvery from 'lodash-es/_arrayEvery';
-import baseHas from 'lodash-es/_baseHas';
-import forOwn from 'lodash-es/forOwn';
-import indexOf from 'lodash-es/indexOf';
-import isArray from 'lodash-es/isArray';
-import okeys from 'lodash-es/keys';
-import noop from 'lodash-es/noop';
-import once from 'lodash-es/once';
-import rest from 'lodash-es/rest';
-
-import setImmediate from './internal/setImmediate';
-
-export default function (tasks, concurrency, callback) {
- if (typeof arguments[1] === 'function') {
- // concurrency is optional, shift the args.
- callback = concurrency;
- concurrency = null;
- }
- callback = once(callback || noop);
- var keys = okeys(tasks);
- var remainingTasks = keys.length;
- if (!remainingTasks) {
- return callback(null);
- }
- if (!concurrency) {
- concurrency = remainingTasks;
- }
-
- var results = {};
- var runningTasks = 0;
- var hasError = false;
-
- var listeners = [];
- function addListener(fn) {
- listeners.unshift(fn);
- }
- function removeListener(fn) {
- var idx = indexOf(listeners, fn);
- if (idx >= 0) listeners.splice(idx, 1);
- }
- function taskComplete() {
- remainingTasks--;
- arrayEach(listeners.slice(), function (fn) {
- fn();
- });
- }
-
- addListener(function () {
- if (!remainingTasks) {
- callback(null, results);
- }
- });
-
- arrayEach(keys, function (k) {
- if (hasError) return;
- var task = isArray(tasks[k]) ? tasks[k]: [tasks[k]];
- var taskCallback = rest(function(err, args) {
- runningTasks--;
- if (args.length <= 1) {
- args = args[0];
- }
- if (err) {
- var safeResults = {};
- forOwn(results, function(val, rkey) {
- safeResults[rkey] = val;
- });
- safeResults[k] = args;
- hasError = true;
-
- callback(err, safeResults);
- }
- else {
- results[k] = args;
- setImmediate(taskComplete);
- }
- });
- var requires = task.slice(0, task.length - 1);
- // prevent dead-locks
- var len = requires.length;
- var dep;
- while (len--) {
- if (!(dep = tasks[requires[len]])) {
- throw new Error('Has non-existent dependency in ' +
- requires.join(', '));
- }
- if (isArray(dep) && indexOf(dep, k) >= 0) {
- throw new Error('Has cyclic dependencies');
- }
- }
- function ready() {
- return runningTasks < concurrency && !baseHas(results, k) &&
- arrayEvery(requires, function (x) {
- return baseHas(results, x);
- });
- }
- if (ready()) {
- runningTasks++;
- task[task.length - 1](taskCallback, results);
- }
- else {
- addListener(listener);
- }
- function listener() {
- if (ready()) {
- runningTasks++;
- removeListener(listener);
- task[task.length - 1](taskCallback, results);
- }
- }
- });
-}
diff --git a/build-es/cargo.js b/build-es/cargo.js
deleted file mode 100644
index b90ab0f..0000000
--- a/build-es/cargo.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-import queue from './internal/queue';
-
-export default function cargo(worker, payload) {
- return queue(worker, 1, payload);
-}
diff --git a/build-es/compose.js b/build-es/compose.js
deleted file mode 100644
index 9e92521..0000000
--- a/build-es/compose.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import seq from './seq';
-
-var reverse = Array.prototype.reverse;
-
-export default function compose(/* functions... */) {
- return seq.apply(null, reverse.call(arguments));
-}
diff --git a/build-es/concat.js b/build-es/concat.js
deleted file mode 100644
index af019a3..0000000
--- a/build-es/concat.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import concat from './internal/concat';
-import doParallel from './internal/doParallel';
-
-export default doParallel(concat);
diff --git a/build-es/concatSeries.js b/build-es/concatSeries.js
deleted file mode 100644
index 76f4043..0000000
--- a/build-es/concatSeries.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import concat from './internal/concat';
-import doSeries from './internal/doSeries';
-
-export default doSeries(concat);
diff --git a/build-es/constant.js b/build-es/constant.js
deleted file mode 100644
index 492d11b..0000000
--- a/build-es/constant.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict';
-
-import rest from 'lodash-es/rest';
-
-export default rest(function(values) {
- var args = [null].concat(values);
- return function (cb) {
- return cb.apply(this, args);
- };
-});
diff --git a/build-es/detect.js b/build-es/detect.js
deleted file mode 100644
index 19fffef..0000000
--- a/build-es/detect.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import identity from 'lodash-es/identity';
-
-import createTester from './internal/createTester';
-import eachOf from './eachOf';
-import findGetResult from './internal/findGetResult';
-
-export default createTester(eachOf, identity, findGetResult);
diff --git a/build-es/detectLimit.js b/build-es/detectLimit.js
deleted file mode 100644
index 0fc46db..0000000
--- a/build-es/detectLimit.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import identity from 'lodash-es/identity';
-
-import createTester from './internal/createTester';
-import eachOfLimit from './eachOfLimit';
-import findGetResult from './internal/findGetResult';
-
-export default createTester(eachOfLimit, identity, findGetResult);
diff --git a/build-es/detectSeries.js b/build-es/detectSeries.js
deleted file mode 100644
index 26f48ba..0000000
--- a/build-es/detectSeries.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import identity from 'lodash-es/identity';
-
-import createTester from './internal/createTester';
-import eachOfSeries from './eachOfSeries';
-import findGetResult from './internal/findGetResult';
-
-export default createTester(eachOfSeries, identity, findGetResult);
diff --git a/build-es/dir.js b/build-es/dir.js
deleted file mode 100644
index 049b416..0000000
--- a/build-es/dir.js
+++ /dev/null
@@ -1,5 +0,0 @@
-'use strict';
-
-import consoleFunc from './internal/consoleFunc';
-
-export default consoleFunc('dir');
diff --git a/build-es/doDuring.js b/build-es/doDuring.js
deleted file mode 100644
index c13e62b..0000000
--- a/build-es/doDuring.js
+++ /dev/null
@@ -1,12 +0,0 @@
-'use strict';
-
-import during from './during';
-
-export default function doDuring(iterator, test, cb) {
- var calls = 0;
-
- during(function(next) {
- if (calls++ < 1) return next(null, true);
- test.apply(this, arguments);
- }, iterator, cb);
-}
diff --git a/build-es/doUntil.js b/build-es/doUntil.js
deleted file mode 100644
index 3bc783f..0000000
--- a/build-es/doUntil.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import doWhilst from './doWhilst';
-
-export default function doUntil(iterator, test, cb) {
- return doWhilst(iterator, function() {
- return !test.apply(this, arguments);
- }, cb);
-}
diff --git a/build-es/doWhilst.js b/build-es/doWhilst.js
deleted file mode 100644
index b05d1d8..0000000
--- a/build-es/doWhilst.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict';
-
-import whilst from './whilst';
-
-export default function doWhilst(iterator, test, cb) {
- var calls = 0;
- return whilst(function() {
- return ++calls <= 1 || test.apply(this, arguments);
- }, iterator, cb);
-}
diff --git a/build-es/during.js b/build-es/during.js
deleted file mode 100644
index e9809cd..0000000
--- a/build-es/during.js
+++ /dev/null
@@ -1,25 +0,0 @@
-'use strict';
-
-import noop from 'lodash-es/noop';
-import rest from 'lodash-es/rest';
-
-export default function during(test, iterator, cb) {
- cb = cb || noop;
-
- var next = rest(function(err, args) {
- if (err) {
- cb(err);
- } else {
- args.push(check);
- test.apply(this, args);
- }
- });
-
- var check = function(err, truth) {
- if (err) return cb(err);
- if (!truth) return cb(null);
- iterator(next);
- };
-
- test(check);
-}
diff --git a/build-es/each.js b/build-es/each.js
deleted file mode 100644
index 384bb0a..0000000
--- a/build-es/each.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict';
-
-import eachOf from './eachOf';
-import withoutIndex from './internal/withoutIndex';
-
-export default function each(arr, iterator, cb) {
- return eachOf(arr, withoutIndex(iterator), cb);
-}
diff --git a/build-es/eachLimit.js b/build-es/eachLimit.js
deleted file mode 100644
index 5009cc3..0000000
--- a/build-es/eachLimit.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import eachOfLimit from './internal/eachOfLimit';
-import withoutIndex from './internal/withoutIndex';
-
-
-export default function eachLimit(arr, limit, iterator, cb) {
- return eachOfLimit(limit)(arr, withoutIndex(iterator), cb);
-}
diff --git a/build-es/eachOf.js b/build-es/eachOf.js
deleted file mode 100644
index e06f2bb..0000000
--- a/build-es/eachOf.js
+++ /dev/null
@@ -1,34 +0,0 @@
-'use strict';
-
-import once from 'lodash-es/once';
-import noop from 'lodash-es/noop';
-
-import keyIterator from './internal/keyIterator';
-import onlyOnce from './internal/onlyOnce';
-
-export default function eachOf(object, iterator, callback) {
- callback = once(callback || noop);
- object = object || [];
-
- var iter = keyIterator(object);
- var key, completed = 0;
-
- while ((key = iter()) != null) {
- completed += 1;
- iterator(object[key], key, onlyOnce(done));
- }
-
- if (completed === 0) callback(null);
-
- function done(err) {
- completed--;
- if (err) {
- callback(err);
- }
- // Check key is null in case iterator isn't exhausted
- // and done resolved synchronously.
- else if (key === null && completed <= 0) {
- callback(null);
- }
- }
-}
diff --git a/build-es/eachOfLimit.js b/build-es/eachOfLimit.js
deleted file mode 100644
index e381474..0000000
--- a/build-es/eachOfLimit.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-import _eachOfLimit from './internal/eachOfLimit';
-
-export default function eachOfLimit(obj, limit, iterator, cb) {
- _eachOfLimit(limit)(obj, iterator, cb);
-}
diff --git a/build-es/eachOfSeries.js b/build-es/eachOfSeries.js
deleted file mode 100644
index 2456bbb..0000000
--- a/build-es/eachOfSeries.js
+++ /dev/null
@@ -1,40 +0,0 @@
-'use strict';
-
-import once from 'lodash-es/once';
-import noop from 'lodash-es/noop';
-
-import keyIterator from './internal/keyIterator';
-import onlyOnce from './internal/onlyOnce';
-import setImmediate from './setImmediate';
-
-export default function eachOfSeries(obj, iterator, callback) {
- callback = once(callback || noop);
- obj = obj || [];
- var nextKey = keyIterator(obj);
- var key = nextKey();
-
- function iterate() {
- var sync = true;
- if (key === null) {
- return callback(null);
- }
- iterator(obj[key], key, onlyOnce(function(err) {
- if (err) {
- callback(err);
- } else {
- key = nextKey();
- if (key === null) {
- return callback(null);
- } else {
- if (sync) {
- setImmediate(iterate);
- } else {
- iterate();
- }
- }
- }
- }));
- sync = false;
- }
- iterate();
-}
diff --git a/build-es/eachSeries.js b/build-es/eachSeries.js
deleted file mode 100644
index fd08c04..0000000
--- a/build-es/eachSeries.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict';
-
-import eachOfSeries from './eachOfSeries';
-import withoutIndex from './internal/withoutIndex';
-
-export default function eachSeries(arr, iterator, cb) {
- return eachOfSeries(arr, withoutIndex(iterator), cb);
-}
diff --git a/build-es/ensureAsync.js b/build-es/ensureAsync.js
deleted file mode 100644
index ba9affd..0000000
--- a/build-es/ensureAsync.js
+++ /dev/null
@@ -1,24 +0,0 @@
-'use strict';
-
-import rest from 'lodash-es/rest';
-
-import setImmediate from './internal/setImmediate';
-
-export default function ensureAsync(fn) {
- return rest(function (args) {
- var callback = args.pop();
- var sync = true;
- args.push(function () {
- var innerArgs = arguments;
- if (sync) {
- setImmediate(function () {
- callback.apply(null, innerArgs);
- });
- } else {
- callback.apply(null, innerArgs);
- }
- });
- fn.apply(this, args);
- sync = false;
- });
-}
diff --git a/build-es/every.js b/build-es/every.js
deleted file mode 100644
index 7ee3713..0000000
--- a/build-es/every.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-import createTester from './internal/createTester';
-import eachOf from './eachOf';
-import notId from './internal/notId';
-
-export default createTester(eachOf, notId, notId);
diff --git a/build-es/everyLimit.js b/build-es/everyLimit.js
deleted file mode 100644
index 4b3fc5f..0000000
--- a/build-es/everyLimit.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-import createTester from './internal/createTester';
-import eachOfLimit from './eachOfLimit';
-import notId from './internal/notId';
-
-export default createTester(eachOfLimit, notId, notId);
diff --git a/build-es/filter.js b/build-es/filter.js
deleted file mode 100644
index 36af2b1..0000000
--- a/build-es/filter.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import filter from './internal/filter';
-import doParallel from './internal/doParallel';
-
-export default doParallel(filter);
diff --git a/build-es/filterLimit.js b/build-es/filterLimit.js
deleted file mode 100644
index 8fe237f..0000000
--- a/build-es/filterLimit.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import filter from './internal/filter';
-import doParallelLimit from './internal/doParallelLimit';
-
-export default doParallelLimit(filter);
diff --git a/build-es/filterSeries.js b/build-es/filterSeries.js
deleted file mode 100644
index 861ca8b..0000000
--- a/build-es/filterSeries.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import filter from './internal/filter';
-import doSeries from './internal/doSeries';
-
-export default doSeries(filter);
diff --git a/build-es/forever.js b/build-es/forever.js
deleted file mode 100644
index fca0684..0000000
--- a/build-es/forever.js
+++ /dev/null
@@ -1,17 +0,0 @@
-'use strict';
-
-import noop from 'lodash-es/noop';
-
-import onlyOnce from './internal/onlyOnce';
-import ensureAsync from './ensureAsync';
-
-export default function forever(fn, cb) {
- var done = onlyOnce(cb || noop);
- var task = ensureAsync(fn);
-
- function next(err) {
- if (err) return done(err);
- task(next);
- }
- next();
-}
diff --git a/build-es/index.js b/build-es/index.js
deleted file mode 100644
index a165909..0000000
--- a/build-es/index.js
+++ /dev/null
@@ -1,228 +0,0 @@
-'use strict';
-
-import applyEach from './applyEach';
-import applyEachSeries from './applyEachSeries';
-import apply from './apply';
-import asyncify from './asyncify';
-import auto from './auto';
-import cargo from './cargo';
-import compose from './compose';
-import concat from './concat';
-import concatSeries from './concatSeries';
-import constant from './constant';
-import detect from './detect';
-import detectLimit from './detectLimit';
-import detectSeries from './detectSeries';
-import dir from './dir';
-import doDuring from './doDuring';
-import doUntil from './doUntil';
-import doWhilst from './doWhilst';
-import during from './during';
-import each from './each';
-import eachLimit from './eachLimit';
-import eachOf from './eachOf';
-import eachOfLimit from './eachOfLimit';
-import eachOfSeries from './eachOfSeries';
-import eachSeries from './eachSeries';
-import ensureAsync from './ensureAsync';
-import every from './every';
-import everyLimit from './everyLimit';
-import filter from './filter';
-import filterLimit from './filterLimit';
-import filterSeries from './filterSeries';
-import forever from './forever';
-import iterator from './iterator';
-import log from './log';
-import map from './map';
-import mapLimit from './mapLimit';
-import mapSeries from './mapSeries';
-import memoize from './memoize';
-import nextTick from './nextTick';
-import parallel from './parallel';
-import parallelLimit from './parallelLimit';
-import priorityQueue from './priorityQueue';
-import queue from './queue';
-import reduce from './reduce';
-import reduceRight from './reduceRight';
-import reject from './reject';
-import rejectLimit from './rejectLimit';
-import rejectSeries from './rejectSeries';
-import retry from './retry';
-import seq from './seq';
-import series from './series';
-import setImmediate from './setImmediate';
-import some from './some';
-import someLimit from './someLimit';
-import sortBy from './sortBy';
-import times from './times';
-import timesLimit from './timesLimit';
-import timesSeries from './timesSeries';
-import transform from './transform';
-import unmemoize from './unmemoize';
-import until from './until';
-import waterfall from './waterfall';
-import whilst from './whilst';
-
-export default {
- applyEach: applyEach,
- applyEachSeries: applyEachSeries,
- apply: apply,
- asyncify: asyncify,
- auto: auto,
- 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: each,
- eachLimit: eachLimit,
- eachOf: eachOf,
- eachOfLimit: eachOfLimit,
- eachOfSeries: eachOfSeries,
- eachSeries: eachSeries,
- ensureAsync: ensureAsync,
- every: every,
- everyLimit: everyLimit,
- filter: filter,
- filterLimit: filterLimit,
- filterSeries: filterSeries,
- forever: forever,
- iterator: iterator,
- log: log,
- map: map,
- mapLimit: mapLimit,
- mapSeries: mapSeries,
- memoize: memoize,
- nextTick: nextTick,
- parallel: parallel,
- parallelLimit: parallelLimit,
- priorityQueue: priorityQueue,
- queue: queue,
- reduce: reduce,
- reduceRight: reduceRight,
- reject: reject,
- rejectLimit: rejectLimit,
- rejectSeries: rejectSeries,
- retry: retry,
- seq: seq,
- series: series,
- setImmediate: setImmediate,
- some: some,
- someLimit: someLimit,
- sortBy: sortBy,
- times: times,
- timesLimit: timesLimit,
- timesSeries: timesSeries,
- transform: transform,
- unmemoize: unmemoize,
- until: until,
- waterfall: waterfall,
- whilst: whilst,
-
- // aliases
- all: every,
- any: some,
- forEach: each,
- forEachSeries: eachSeries,
- forEachLimit: eachLimit,
- forEachOf: eachOf,
- forEachOfSeries: eachOfSeries,
- forEachOfLimit: eachOfLimit,
- inject: reduce,
- foldl: reduce,
- foldr: reduceRight,
- select: filter,
- selectLimit: filterLimit,
- selectSeries: filterSeries,
- wrapSync: asyncify
-};
-
-export {
- applyEach as applyEach,
- applyEachSeries as applyEachSeries,
- apply as apply,
- asyncify as asyncify,
- auto as auto,
- cargo as cargo,
- compose as compose,
- concat as concat,
- concatSeries as concatSeries,
- constant as constant,
- detect as detect,
- detectLimit as detectLimit,
- detectSeries as detectSeries,
- dir as dir,
- doDuring as doDuring,
- doUntil as doUntil,
- doWhilst as doWhilst,
- during as during,
- each as each,
- eachLimit as eachLimit,
- eachOf as eachOf,
- eachOfLimit as eachOfLimit,
- eachOfSeries as eachOfSeries,
- eachSeries as eachSeries,
- ensureAsync as ensureAsync,
- every as every,
- everyLimit as everyLimit,
- filter as filter,
- filterLimit as filterLimit,
- filterSeries as filterSeries,
- forever as forever,
- iterator as iterator,
- log as log,
- map as map,
- mapLimit as mapLimit,
- mapSeries as mapSeries,
- memoize as memoize,
- nextTick as nextTick,
- parallel as parallel,
- parallelLimit as parallelLimit,
- priorityQueue as priorityQueue,
- queue as queue,
- reduce as reduce,
- reduceRight as reduceRight,
- reject as reject,
- rejectLimit as rejectLimit,
- rejectSeries as rejectSeries,
- retry as retry,
- seq as seq,
- series as series,
- setImmediate as setImmediate,
- some as some,
- someLimit as someLimit,
- sortBy as sortBy,
- times as times,
- timesLimit as timesLimit,
- timesSeries as timesSeries,
- transform as transform,
- unmemoize as unmemoize,
- until as until,
- waterfall as waterfall,
- whilst as whilst,
-
- // Aliases
- every as all,
- some as any,
- each as forEach,
- eachSeries as forEachSeries,
- eachLimit as forEachLimit,
- eachOf as forEachOf,
- eachOfSeries as forEachOfSeries,
- eachOfLimit as forEachOfLimit,
- reduce as inject,
- reduce as foldl,
- reduceRight as foldr,
- filter as select,
- filterLimit as selectLimit,
- filterSeries as selectSeries,
- asyncify as wrapSync
-};
diff --git a/build-es/internal/applyEach.js b/build-es/internal/applyEach.js
deleted file mode 100644
index 1467363..0000000
--- a/build-es/internal/applyEach.js
+++ /dev/null
@@ -1,22 +0,0 @@
-'use strict';
-
-import rest from 'lodash-es/rest';
-
-export default function applyEach(eachfn) {
- return rest(function(fns, args) {
- var go = rest(function(args) {
- var that = this;
- var callback = args.pop();
- return eachfn(fns, function (fn, _, cb) {
- fn.apply(that, args.concat([cb]));
- },
- callback);
- });
- if (args.length) {
- return go.apply(this, args);
- }
- else {
- return go;
- }
- });
-}
diff --git a/build-es/internal/concat.js b/build-es/internal/concat.js
deleted file mode 100644
index 482ad3a..0000000
--- a/build-es/internal/concat.js
+++ /dev/null
@@ -1,13 +0,0 @@
-'use strict';
-
-export default function concat(eachfn, arr, fn, callback) {
- var result = [];
- eachfn(arr, function (x, index, cb) {
- fn(x, function (err, y) {
- result = result.concat(y || []);
- cb(err);
- });
- }, function (err) {
- callback(err, result);
- });
-}
diff --git a/build-es/internal/consoleFunc.js b/build-es/internal/consoleFunc.js
deleted file mode 100644
index d56a7bd..0000000
--- a/build-es/internal/consoleFunc.js
+++ /dev/null
@@ -1,23 +0,0 @@
-'use strict';
-
-import arrayEach from 'lodash-es/_arrayEach';
-import rest from 'lodash-es/rest';
-
-export default function consoleFunc(name) {
- return rest(function (fn, args) {
- fn.apply(null, args.concat([rest(function (err, args) {
- if (typeof console === 'object') {
- if (err) {
- if (console.error) {
- console.error(err);
- }
- }
- else if (console[name]) {
- arrayEach(args, function (x) {
- console[name](x);
- });
- }
- }
- })]));
- });
-}
diff --git a/build-es/internal/createTester.js b/build-es/internal/createTester.js
deleted file mode 100644
index 0e9e750..0000000
--- a/build-es/internal/createTester.js
+++ /dev/null
@@ -1,37 +0,0 @@
-'use strict';
-
-export default function _createTester(eachfn, check, getResult) {
- return function(arr, limit, iterator, cb) {
- function done(err) {
- if (cb) {
- if (err) {
- cb(err);
- } else {
- cb(null, getResult(false, void 0));
- }
- }
- }
- function iteratee(x, _, callback) {
- if (!cb) return callback();
- iterator(x, function (err, v) {
- if (cb) {
- if (err) {
- cb(err);
- cb = iterator = false;
- } else if (check(v)) {
- cb(null, getResult(true, x));
- cb = iterator = false;
- }
- }
- callback();
- });
- }
- if (arguments.length > 3) {
- eachfn(arr, limit, iteratee, done);
- } else {
- cb = iterator;
- iterator = limit;
- eachfn(arr, iteratee, done);
- }
- };
-}
diff --git a/build-es/internal/doParallel.js b/build-es/internal/doParallel.js
deleted file mode 100644
index 19c90fc..0000000
--- a/build-es/internal/doParallel.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import eachOf from '../eachOf';
-
-export default function doParallel(fn) {
- return function (obj, iterator, callback) {
- return fn(eachOf, obj, iterator, callback);
- };
-}
diff --git a/build-es/internal/doParallelLimit.js b/build-es/internal/doParallelLimit.js
deleted file mode 100644
index 0c3bcf7..0000000
--- a/build-es/internal/doParallelLimit.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import eachOfLimit from './eachOfLimit';
-
-export default function doParallelLimit(fn) {
- return function (obj, limit, iterator, callback) {
- return fn(eachOfLimit(limit), obj, iterator, callback);
- };
-}
diff --git a/build-es/internal/doSeries.js b/build-es/internal/doSeries.js
deleted file mode 100644
index c7f1d99..0000000
--- a/build-es/internal/doSeries.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import eachOfSeries from '../eachOfSeries';
-
-export default function doSeries(fn) {
- return function (obj, iterator, callback) {
- return fn(eachOfSeries, obj, iterator, callback);
- };
-}
diff --git a/build-es/internal/eachOfLimit.js b/build-es/internal/eachOfLimit.js
deleted file mode 100644
index 5235278..0000000
--- a/build-es/internal/eachOfLimit.js
+++ /dev/null
@@ -1,49 +0,0 @@
-'use strict';
-
-import noop from 'lodash-es/noop';
-import once from 'lodash-es/once';
-
-import keyIterator from './keyIterator';
-import onlyOnce from './onlyOnce';
-
-export default function _eachOfLimit(limit) {
- return function (obj, iterator, callback) {
- callback = once(callback || noop);
- obj = obj || [];
- var nextKey = keyIterator(obj);
- if (limit <= 0) {
- return callback(null);
- }
- var done = false;
- var running = 0;
- var errored = false;
-
- (function replenish () {
- if (done && running <= 0) {
- return callback(null);
- }
-
- while (running < limit && !errored) {
- var key = nextKey();
- if (key === null) {
- done = true;
- if (running <= 0) {
- callback(null);
- }
- return;
- }
- running += 1;
- iterator(obj[key], key, onlyOnce(function (err) {
- running -= 1;
- if (err) {
- callback(err);
- errored = true;
- }
- else {
- replenish();
- }
- }));
- }
- })();
- };
-}
diff --git a/build-es/internal/filter.js b/build-es/internal/filter.js
deleted file mode 100644
index d1ab3e3..0000000
--- a/build-es/internal/filter.js
+++ /dev/null
@@ -1,30 +0,0 @@
-'use strict';
-
-import arrayMap from 'lodash-es/_arrayMap';
-import property from 'lodash-es/_baseProperty';
-
-export default function _filter(eachfn, arr, iterator, callback) {
- var results = [];
- eachfn(arr, function (x, index, callback) {
- iterator(x, function (err, v) {
- if (err) {
- callback(err);
- }
- else {
- if (v) {
- results.push({index: index, value: x});
- }
- callback();
- }
- });
- }, function (err) {
- if (err) {
- callback(err);
- }
- else {
- callback(null, arrayMap(results.sort(function (a, b) {
- return a.index - b.index;
- }), property('value')));
- }
- });
-}
diff --git a/build-es/internal/findGetResult.js b/build-es/internal/findGetResult.js
deleted file mode 100644
index 3aeb07d..0000000
--- a/build-es/internal/findGetResult.js
+++ /dev/null
@@ -1,5 +0,0 @@
-'use strict';
-
-export default function _findGetResult(v, x) {
- return x;
-}
diff --git a/build-es/internal/keyIterator.js b/build-es/internal/keyIterator.js
deleted file mode 100644
index 9f12beb..0000000
--- a/build-es/internal/keyIterator.js
+++ /dev/null
@@ -1,23 +0,0 @@
-'use strict';
-
-import isArrayLike from 'lodash-es/isArrayLike';
-import keys from 'lodash-es/keys';
-
-export default function keyIterator(coll) {
- var i = -1;
- var len;
- if (isArrayLike(coll)) {
- len = coll.length;
- return function next() {
- i++;
- return i < len ? i : null;
- };
- } else {
- var okeys = keys(coll);
- len = okeys.length;
- return function next() {
- i++;
- return i < len ? okeys[i] : null;
- };
- }
-}
diff --git a/build-es/internal/map.js b/build-es/internal/map.js
deleted file mode 100644
index 5057f49..0000000
--- a/build-es/internal/map.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict';
-
-import isArrayLike from 'lodash-es/isArrayLike';
-import noop from 'lodash-es/noop';
-import once from 'lodash-es/once';
-
-export default function _asyncMap(eachfn, arr, iterator, callback) {
- callback = once(callback || noop);
- arr = arr || [];
- var results = isArrayLike(arr) ? [] : {};
- eachfn(arr, function (value, index, callback) {
- iterator(value, function (err, v) {
- results[index] = v;
- callback(err);
- });
- }, function (err) {
- callback(err, results);
- });
-}
diff --git a/build-es/internal/notId.js b/build-es/internal/notId.js
deleted file mode 100644
index d936aab..0000000
--- a/build-es/internal/notId.js
+++ /dev/null
@@ -1,5 +0,0 @@
-'use strict';
-
-export default function notId(v) {
- return !v;
-}
diff --git a/build-es/internal/onlyOnce.js b/build-es/internal/onlyOnce.js
deleted file mode 100644
index f4241c8..0000000
--- a/build-es/internal/onlyOnce.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-export default function onlyOnce(fn) {
- return function() {
- if (fn === null) throw new Error("Callback was already called.");
- fn.apply(this, arguments);
- fn = null;
- };
-}
diff --git a/build-es/internal/parallel.js b/build-es/internal/parallel.js
deleted file mode 100644
index b532908..0000000
--- a/build-es/internal/parallel.js
+++ /dev/null
@@ -1,22 +0,0 @@
-'use strict';
-
-import noop from 'lodash-es/noop';
-import isArrayLike from 'lodash-es/isArrayLike';
-import rest from 'lodash-es/rest';
-
-export default function _parallel(eachfn, tasks, callback) {
- callback = callback || noop;
- var results = isArrayLike(tasks) ? [] : {};
-
- eachfn(tasks, function (task, key, callback) {
- task(rest(function (err, args) {
- if (args.length <= 1) {
- args = args[0];
- }
- results[key] = args;
- callback(err);
- }));
- }, function (err) {
- callback(err, results);
- });
-}
diff --git a/build-es/internal/queue.js b/build-es/internal/queue.js
deleted file mode 100644
index e15229b..0000000
--- a/build-es/internal/queue.js
+++ /dev/null
@@ -1,140 +0,0 @@
-'use strict';
-
-import arrayEach from 'lodash-es/_arrayEach';
-import arrayMap from 'lodash-es/_arrayMap';
-import isArray from 'lodash-es/isArray';
-import noop from 'lodash-es/noop';
-import property from 'lodash-es/_baseProperty';
-
-import onlyOnce from './onlyOnce';
-import setImmediate from './setImmediate';
-
-export default function queue(worker, concurrency, payload) {
- if (concurrency == null) {
- concurrency = 1;
- }
- else if(concurrency === 0) {
- throw new Error('Concurrency must not be zero');
- }
- function _insert(q, data, pos, callback) {
- if (callback != null && typeof callback !== 'function') {
- throw new Error('task callback must be a function');
- }
- q.started = true;
- if (!isArray(data)) {
- data = [data];
- }
- if(data.length === 0 && q.idle()) {
- // call drain immediately if there are no tasks
- return setImmediate(function() {
- q.drain();
- });
- }
- arrayEach(data, function(task) {
- var item = {
- data: task,
- callback: callback || noop
- };
-
- if (pos) {
- q.tasks.unshift(item);
- } else {
- q.tasks.push(item);
- }
-
- if (q.tasks.length === q.concurrency) {
- q.saturated();
- }
- });
- setImmediate(q.process);
- }
- function _next(q, tasks) {
- return function(){
- workers -= 1;
-
- var removed = false;
- var args = arguments;
- arrayEach(tasks, function (task) {
- arrayEach(workersList, function (worker, index) {
- if (worker === task && !removed) {
- workersList.splice(index, 1);
- removed = true;
- }
- });
-
- task.callback.apply(task, args);
- });
- if (q.tasks.length + workers === 0) {
- q.drain();
- }
- q.process();
- };
- }
-
- var workers = 0;
- var workersList = [];
- var q = {
- tasks: [],
- concurrency: concurrency,
- payload: payload,
- saturated: noop,
- empty: noop,
- drain: noop,
- started: false,
- paused: false,
- push: function (data, callback) {
- _insert(q, data, false, callback);
- },
- kill: function () {
- q.drain = noop;
- q.tasks = [];
- },
- unshift: function (data, callback) {
- _insert(q, data, true, callback);
- },
- process: function () {
- while(!q.paused && workers < q.concurrency && q.tasks.length){
-
- var tasks = q.payload ?
- q.tasks.splice(0, q.payload) :
- q.tasks.splice(0, q.tasks.length);
-
- var data = arrayMap(tasks, property('data'));
-
- if (q.tasks.length === 0) {
- q.empty();
- }
- workers += 1;
- workersList.push(tasks[0]);
- var cb = onlyOnce(_next(q, tasks));
- worker(data, cb);
- }
- },
- length: function () {
- return q.tasks.length;
- },
- running: function () {
- return workers;
- },
- workersList: function () {
- return workersList;
- },
- idle: function() {
- return q.tasks.length + workers === 0;
- },
- pause: function () {
- q.paused = true;
- },
- resume: function () {
- if (q.paused === false) { return; }
- q.paused = false;
- var resumeCount = Math.min(q.concurrency, q.tasks.length);
- // Need to call q.process once per concurrent
- // worker to preserve full concurrency after pause
- for (var w = 1; w <= resumeCount; w++) {
- setImmediate(q.process);
- }
- }
- };
- return q;
-}
diff --git a/build-es/internal/reject.js b/build-es/internal/reject.js
deleted file mode 100644
index 708e810..0000000
--- a/build-es/internal/reject.js
+++ /dev/null
@@ -1,15 +0,0 @@
-'use strict';
-
-import filter from './filter';
-
-export default function reject(eachfn, arr, iterator, callback) {
- filter(eachfn, arr, function(value, cb) {
- iterator(value, function(err, v) {
- if (err) {
- cb(err);
- } else {
- cb(null, !v);
- }
- });
- }, callback);
-}
diff --git a/build-es/internal/setImmediate.js b/build-es/internal/setImmediate.js
deleted file mode 100644
index c02ad71..0000000
--- a/build-es/internal/setImmediate.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict';
-
-var _setImmediate = typeof setImmediate === 'function' && setImmediate;
-
-var _delay;
-if (_setImmediate) {
- _delay = function(fn) {
- // not a direct alias for IE10 compatibility
- _setImmediate(fn);
- };
-} else if (typeof process === 'object' && typeof process.nextTick === 'function') {
- _delay = process.nextTick;
-} else {
- _delay = function(fn) {
- setTimeout(fn, 0);
- };
-}
-
-export default _delay;
diff --git a/build-es/internal/withoutIndex.js b/build-es/internal/withoutIndex.js
deleted file mode 100644
index f163ff3..0000000
--- a/build-es/internal/withoutIndex.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-export default function _withoutIndex(iterator) {
- return function (value, index, callback) {
- return iterator(value, callback);
- };
-}
diff --git a/build-es/iterator.js b/build-es/iterator.js
deleted file mode 100644
index 568171a..0000000
--- a/build-es/iterator.js
+++ /dev/null
@@ -1,17 +0,0 @@
-'use strict';
-
-export default function(tasks) {
- function makeCallback(index) {
- function fn() {
- if (tasks.length) {
- tasks[index].apply(null, arguments);
- }
- return fn.next();
- }
- fn.next = function() {
- return (index < tasks.length - 1) ? makeCallback(index + 1) : null;
- };
- return fn;
- }
- return makeCallback(0);
-}
diff --git a/build-es/log.js b/build-es/log.js
deleted file mode 100644
index b581264..0000000
--- a/build-es/log.js
+++ /dev/null
@@ -1,5 +0,0 @@
-'use strict';
-
-import consoleFunc from './internal/consoleFunc';
-
-export default consoleFunc('log');
diff --git a/build-es/map.js b/build-es/map.js
deleted file mode 100644
index 2a8449c..0000000
--- a/build-es/map.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import doParallel from './internal/doParallel';
-import map from './internal/map';
-
-export default doParallel(map);
diff --git a/build-es/mapLimit.js b/build-es/mapLimit.js
deleted file mode 100644
index 642b4c6..0000000
--- a/build-es/mapLimit.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import doParallelLimit from './internal/doParallelLimit';
-import map from './internal/map';
-
-export default doParallelLimit(map);
diff --git a/build-es/mapSeries.js b/build-es/mapSeries.js
deleted file mode 100644
index bfcdaa2..0000000
--- a/build-es/mapSeries.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import map from './internal/map';
-import doSeries from './internal/doSeries';
-
-export default doSeries(map);
diff --git a/build-es/memoize.js b/build-es/memoize.js
deleted file mode 100644
index 8e66b85..0000000
--- a/build-es/memoize.js
+++ /dev/null
@@ -1,37 +0,0 @@
-'use strict';
-
-import identity from 'lodash-es/identity';
-import rest from 'lodash-es/rest';
-import has from 'lodash-es/has';
-
-import setImmediate from './internal/setImmediate';
-
-export default function memoize(fn, hasher) {
- var memo = Object.create(null);
- var queues = Object.create(null);
- hasher = hasher || identity;
- var memoized = rest(function memoized(args) {
- var callback = args.pop();
- var key = hasher.apply(null, args);
- if (has(memo, key)) {
- setImmediate(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) {
- 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;
- memoized.unmemoized = fn;
- return memoized;
-}
diff --git a/build-es/nextTick.js b/build-es/nextTick.js
deleted file mode 100644
index b61a8b4..0000000
--- a/build-es/nextTick.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-import setImmediate from './internal/setImmediate';
-
-var nexTick = typeof process === 'object' && typeof process.nextTick === 'function' ? process.nextTick : setImmediate;
-
-export default nexTick;
diff --git a/build-es/package.json b/build-es/package.json
deleted file mode 100644
index b07ed66..0000000
--- a/build-es/package.json
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "name": "async-es",
- "description": "Higher-order functions and common patterns for asynchronous code",
- "version": "2.0.0-alpha",
- "main": "index.js",
- "author": "Caolan McMahon",
- "repository": {
- "type": "git",
- "url": "https://github.com/caolan/async.git"
- },
- "bugs": {
- "url": "https://github.com/caolan/async/issues"
- },
- "keywords": [
- "async",
- "callback",
- "module",
- "utility"
- ],
- "dependencies": {
- "lodash-es": "^4.3.0"
- },
- "devDependencies": {
- "babel-cli": "^6.3.17",
- "babel-core": "^6.3.26",
- "babel-plugin-add-module-exports": "~0.1.2",
- "babel-plugin-transform-es2015-modules-commonjs": "^6.3.16",
- "babel-preset-es2015": "^6.3.13",
- "babelify": "^7.2.0",
- "benchmark": "bestiejs/benchmark.js",
- "bluebird": "^2.9.32",
- "chai": "^3.1.0",
- "coveralls": "^2.11.2",
- "es6-promise": "^2.3.0",
- "fs-extra": "^0.26.3",
- "gulp": "~3.9.0",
- "jscs": "^1.13.1",
- "jshint": "~2.8.0",
- "karma": "^0.13.2",
- "karma-browserify": "^4.2.1",
- "karma-firefox-launcher": "^0.1.6",
- "karma-mocha": "^0.2.0",
- "karma-mocha-reporter": "^1.0.2",
- "mocha": "^2.2.5",
- "native-promise-only": "^0.8.0-a",
- "nodeunit": ">0.0.0",
- "nyc": "^2.1.0",
- "recursive-readdir": "^1.3.0",
- "rimraf": "^2.5.0",
- "rollup": "^0.25.0",
- "rollup-plugin-npm": "~1.3.0",
- "rsvp": "^3.0.18",
- "semver": "^4.3.6",
- "uglify-js": "~2.4.0",
- "vinyl-buffer": "~1.0.0",
- "vinyl-source-stream": "~1.1.0",
- "yargs": "~3.9.1"
- },
- "scripts": {
- "coverage": "nyc npm test && nyc report",
- "coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls",
- "lint": "jshint lib/ test/ mocha_test/ perf/memory.js perf/suites.js perf/benchmark.js support/ gulpfile.js karma.conf.js && jscs lib/ test/ mocha_test/ perf/memory.js perf/suites.js perf/benchmark.js support/ gulpfile.js karma.conf.js",
- "mocha-browser-test": "karma start",
- "mocha-node-test": "mocha mocha_test/ --compilers js:babel-core/register",
- "mocha-test": "npm run mocha-node-test && npm run mocha-browser-test",
- "nodeunit-test": "nodeunit test/test-async.js",
- "test": "npm run-script lint && npm run nodeunit-test && npm run mocha-test"
- },
- "license": "MIT"
-} \ No newline at end of file
diff --git a/build-es/parallel.js b/build-es/parallel.js
deleted file mode 100644
index d3eec16..0000000
--- a/build-es/parallel.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict';
-
-import _parallel from './internal/parallel';
-import eachOf from './eachOf';
-
-export default function parallel(tasks, cb) {
- return _parallel(eachOf, tasks, cb);
-}
diff --git a/build-es/parallelLimit.js b/build-es/parallelLimit.js
deleted file mode 100644
index 7e66bed..0000000
--- a/build-es/parallelLimit.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict';
-
-import eachOfLimit from './internal/eachOfLimit';
-import parallel from './internal/parallel';
-
-export default function parallelLimit(tasks, limit, cb) {
- return parallel(eachOfLimit(limit), tasks, cb);
-}
diff --git a/build-es/priorityQueue.js b/build-es/priorityQueue.js
deleted file mode 100644
index b22e96f..0000000
--- a/build-es/priorityQueue.js
+++ /dev/null
@@ -1,72 +0,0 @@
-'use strict';
-
-import arrayEach from 'lodash-es/_arrayEach';
-import isArray from 'lodash-es/isArray';
-import noop from 'lodash-es/noop';
-
-import setImmediate from './setImmediate';
-
-import queue from './queue';
-
-export default function(worker, concurrency) {
- function _compareTasks(a, b) {
- return a.priority - b.priority;
- }
-
- function _binarySearch(sequence, item, compare) {
- var beg = -1,
- end = sequence.length - 1;
- while (beg < end) {
- var mid = beg + ((end - beg + 1) >>> 1);
- if (compare(item, sequence[mid]) >= 0) {
- beg = mid;
- } else {
- end = mid - 1;
- }
- }
- return beg;
- }
-
- function _insert(q, data, priority, callback) {
- if (callback != null && typeof callback !== 'function') {
- throw new Error('task callback must be a function');
- }
- q.started = true;
- if (!isArray(data)) {
- data = [data];
- }
- if (data.length === 0) {
- // call drain immediately if there are no tasks
- return setImmediate(function() {
- q.drain();
- });
- }
- arrayEach(data, function(task) {
- var item = {
- data: task,
- priority: priority,
- callback: typeof callback === 'function' ? callback : noop
- };
-
- q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item);
-
- if (q.tasks.length === q.concurrency) {
- q.saturated();
- }
- setImmediate(q.process);
- });
- }
-
- // Start with a normal queue
- var q = queue(worker, concurrency);
-
- // Override push to accept second parameter representing priority
- q.push = function(data, priority, callback) {
- _insert(q, data, priority, callback);
- };
-
- // Remove unshift function
- delete q.unshift;
-
- return q;
-}
diff --git a/build-es/queue.js b/build-es/queue.js
deleted file mode 100644
index de2ac93..0000000
--- a/build-es/queue.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import queue from './internal/queue';
-
-export default function (worker, concurrency) {
- return queue(function (items, cb) {
- worker(items[0], cb);
- }, concurrency, 1);
-}
diff --git a/build-es/reduce.js b/build-es/reduce.js
deleted file mode 100644
index 51b736a..0000000
--- a/build-es/reduce.js
+++ /dev/null
@@ -1,14 +0,0 @@
-'use strict';
-
-import eachOfSeries from './eachOfSeries';
-
-export default function reduce(arr, memo, iterator, cb) {
- eachOfSeries(arr, function(x, i, cb) {
- iterator(memo, x, function(err, v) {
- memo = v;
- cb(err);
- });
- }, function(err) {
- cb(err, memo);
- });
-}
diff --git a/build-es/reduceRight.js b/build-es/reduceRight.js
deleted file mode 100644
index 730e320..0000000
--- a/build-es/reduceRight.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict';
-
-import reduce from './reduce';
-
-var slice = Array.prototype.slice;
-
-export default function reduceRight (arr, memo, iterator, cb) {
- var reversed = slice.call(arr).reverse();
- reduce(reversed, memo, iterator, cb);
-}
diff --git a/build-es/reject.js b/build-es/reject.js
deleted file mode 100644
index fb5b87f..0000000
--- a/build-es/reject.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import reject from './internal/reject';
-import doParallel from './internal/doParallel';
-
-export default doParallel(reject);
diff --git a/build-es/rejectLimit.js b/build-es/rejectLimit.js
deleted file mode 100644
index 7cefed6..0000000
--- a/build-es/rejectLimit.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import reject from './internal/reject';
-import doParallelLimit from './internal/doParallelLimit';
-
-export default doParallelLimit(reject);
diff --git a/build-es/rejectSeries.js b/build-es/rejectSeries.js
deleted file mode 100644
index e02adea..0000000
--- a/build-es/rejectSeries.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict';
-
-import reject from './internal/reject';
-import doSeries from './internal/doSeries';
-
-export default doSeries(reject);
diff --git a/build-es/retry.js b/build-es/retry.js
deleted file mode 100644
index 506a424..0000000
--- a/build-es/retry.js
+++ /dev/null
@@ -1,77 +0,0 @@
-'use strict';
-
-import series from './series';
-
-export default function retry(times, task, callback) {
- var DEFAULT_TIMES = 5;
- var DEFAULT_INTERVAL = 0;
-
- var attempts = [];
-
- var opts = {
- times: DEFAULT_TIMES,
- interval: DEFAULT_INTERVAL
- };
-
- function parseTimes(acc, t) {
- if (typeof t === 'number') {
- acc.times = parseInt(t, 10) || DEFAULT_TIMES;
- } else if (typeof t === 'object') {
- acc.times = parseInt(t.times, 10) || DEFAULT_TIMES;
- acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL;
- } else {
- throw new Error('Unsupported argument type for \'times\': ' + typeof t);
- }
- }
-
- var length = arguments.length;
- if (length < 1 || length > 3) {
- throw new Error('Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)');
- } else if (length <= 2 && typeof times === 'function') {
- callback = task;
- task = times;
- }
- if (typeof times !== 'function') {
- parseTimes(opts, times);
- }
- opts.callback = callback;
- opts.task = task;
-
- function wrappedTask(wrappedCallback, wrappedResults) {
- function retryAttempt(task, finalAttempt) {
- return function(seriesCallback) {
- task(function(err, result) {
- seriesCallback(!err || finalAttempt, {
- err: err,
- result: result
- });
- }, wrappedResults);
- };
- }
-
- function retryInterval(interval) {
- return function(seriesCallback) {
- setTimeout(function() {
- seriesCallback(null);
- }, interval);
- };
- }
-
- while (opts.times) {
-
- var finalAttempt = !(opts.times -= 1);
- attempts.push(retryAttempt(opts.task, finalAttempt));
- if (!finalAttempt && opts.interval > 0) {
- attempts.push(retryInterval(opts.interval));
- }
- }
-
- series(attempts, function(done, data) {
- data = data[data.length - 1];
- (wrappedCallback || opts.callback)(data.err, data.result);
- });
- }
-
- // If a callback is passed, run this as a controll flow
- return opts.callback ? wrappedTask() : wrappedTask;
-}
diff --git a/build-es/seq.js b/build-es/seq.js
deleted file mode 100644
index c9e02c1..0000000
--- a/build-es/seq.js
+++ /dev/null
@@ -1,28 +0,0 @@
-'use strict';
-
-import noop from 'lodash-es/noop';
-import rest from 'lodash-es/rest';
-import reduce from './reduce';
-
-export default function seq( /* functions... */ ) {
- var fns = arguments;
- return rest(function(args) {
- var that = this;
-
- var cb = args[args.length - 1];
- if (typeof cb == 'function') {
- args.pop();
- } else {
- cb = noop;
- }
-
- reduce(fns, args, function(newargs, fn, cb) {
- fn.apply(that, newargs.concat([rest(function(err, nextargs) {
- cb(err, nextargs);
- })]));
- },
- function(err, results) {
- cb.apply(that, [err].concat(results));
- });
- });
-}
diff --git a/build-es/series.js b/build-es/series.js
deleted file mode 100644
index bd8e15d..0000000
--- a/build-es/series.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict';
-
-import parallel from './internal/parallel';
-import eachOfSeries from './eachOfSeries';
-
-export default function series(tasks, cb) {
- return parallel(eachOfSeries, tasks, cb);
-}
diff --git a/build-es/setImmediate.js b/build-es/setImmediate.js
deleted file mode 100644
index 05d9555..0000000
--- a/build-es/setImmediate.js
+++ /dev/null
@@ -1,5 +0,0 @@
-'use strict';
-
-import setImmediate from './internal/setImmediate';
-
-export default setImmediate;
diff --git a/build-es/some.js b/build-es/some.js
deleted file mode 100644
index 46532b7..0000000
--- a/build-es/some.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict';
-
-import identity from 'lodash-es/identity';
-
-import createTester from './internal/createTester';
-import eachOf from './eachOf';
-
-export default createTester(eachOf, Boolean, identity);
diff --git a/build-es/someLimit.js b/build-es/someLimit.js
deleted file mode 100644
index 6c17067..0000000
--- a/build-es/someLimit.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-import createTester from './internal/createTester';
-import eachOfLimit from './eachOfLimit';
-import identity from 'lodash-es/identity';
-
-export default createTester(eachOfLimit, Boolean, identity);
diff --git a/build-es/sortBy.js b/build-es/sortBy.js
deleted file mode 100644
index 75d61ca..0000000
--- a/build-es/sortBy.js
+++ /dev/null
@@ -1,23 +0,0 @@
-'use strict';
-
-import arrayMap from 'lodash-es/_arrayMap';
-import property from 'lodash-es/_baseProperty';
-
-import map from './map';
-
-export default function sortBy (arr, iterator, cb) {
- map(arr, function (x, cb) {
- iterator(x, function (err, criteria) {
- if (err) return cb(err);
- cb(null, {value: x, criteria: criteria});
- });
- }, function (err, results) {
- if (err) return cb(err);
- cb(null, arrayMap(results.sort(comparator), property('value')));
- });
-
- function comparator(left, right) {
- var a = left.criteria, b = right.criteria;
- return a < b ? -1 : a > b ? 1 : 0;
- }
-}
diff --git a/build-es/times.js b/build-es/times.js
deleted file mode 100644
index a03cd0c..0000000
--- a/build-es/times.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict';
-
-import map from './map';
-import range from 'lodash-es/_baseRange';
-
-export default function (count, iterator, callback) {
- map(range(0, count, 1), iterator, callback);
-}
diff --git a/build-es/timesLimit.js b/build-es/timesLimit.js
deleted file mode 100644
index 391652f..0000000
--- a/build-es/timesLimit.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict';
-
-import mapLimit from './mapLimit';
-import range from 'lodash-es/_baseRange';
-
-export default function timeLimit(count, limit, iterator, cb) {
- return mapLimit(range(0, count, 1), limit, iterator, cb);
-}
diff --git a/build-es/timesSeries.js b/build-es/timesSeries.js
deleted file mode 100644
index f73a435..0000000
--- a/build-es/timesSeries.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict';
-
-import mapSeries from './mapSeries';
-import range from 'lodash-es/_baseRange';
-
-export default function (count, iterator, callback) {
- mapSeries(range(0, count, 1), iterator, callback);
-}
diff --git a/build-es/transform.js b/build-es/transform.js
deleted file mode 100644
index 7b80fca..0000000
--- a/build-es/transform.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict';
-
-import isArray from 'lodash-es/isArray';
-
-import eachOf from './eachOf';
-
-export default function transform (arr, memo, iterator, callback) {
- if (arguments.length === 3) {
- callback = iterator;
- iterator = memo;
- memo = isArray(arr) ? [] : {};
- }
-
- eachOf(arr, function(v, k, cb) {
- iterator(memo, v, k, cb);
- }, function(err) {
- callback(err, memo);
- });
-}
diff --git a/build-es/unmemoize.js b/build-es/unmemoize.js
deleted file mode 100644
index d652e7b..0000000
--- a/build-es/unmemoize.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-export default function unmemoize(fn) {
- return function () {
- return (fn.unmemoized || fn).apply(null, arguments);
- };
-}
diff --git a/build-es/until.js b/build-es/until.js
deleted file mode 100644
index f9ed2fd..0000000
--- a/build-es/until.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-import whilst from './whilst';
-
-export default function until(test, iterator, cb) {
- return whilst(function() {
- return !test.apply(this, arguments);
- }, iterator, cb);
-}
diff --git a/build-es/waterfall.js b/build-es/waterfall.js
deleted file mode 100644
index c629bcf..0000000
--- a/build-es/waterfall.js
+++ /dev/null
@@ -1,32 +0,0 @@
-'use strict';
-
-import isArray from 'lodash-es/isArray';
-import noop from 'lodash-es/noop';
-import once from 'lodash-es/once';
-import rest from 'lodash-es/rest';
-
-import ensureAsync from './ensureAsync';
-import iterator from './iterator';
-
-export default function(tasks, cb) {
- cb = once(cb || noop);
- if (!isArray(tasks)) return cb(new Error('First argument to waterfall must be an array of functions'));
- if (!tasks.length) return cb();
-
- function wrapIterator(iterator) {
- return rest(function(err, args) {
- if (err) {
- cb.apply(null, [err].concat(args));
- } else {
- var next = iterator.next();
- if (next) {
- args.push(wrapIterator(next));
- } else {
- args.push(cb);
- }
- ensureAsync(iterator).apply(null, args);
- }
- });
- }
- wrapIterator(iterator(tasks))();
-}
diff --git a/build-es/whilst.js b/build-es/whilst.js
deleted file mode 100644
index 2f5c2ef..0000000
--- a/build-es/whilst.js
+++ /dev/null
@@ -1,15 +0,0 @@
-'use strict';
-
-import noop from 'lodash-es/noop';
-import rest from 'lodash-es/rest';
-
-export default function whilst(test, iterator, cb) {
- cb = cb || noop;
- if (!test()) return cb(null);
- var next = rest(function(err, args) {
- if (err) return cb(err);
- if (test.apply(this, args)) return iterator(next);
- cb.apply(null, [null].concat(args));
- });
- iterator(next);
-}
diff --git a/build/CHANGELOG.md b/build/CHANGELOG.md
deleted file mode 100644
index f15e081..0000000
--- a/build/CHANGELOG.md
+++ /dev/null
@@ -1,125 +0,0 @@
-# v1.5.2
-- Allow using `"consructor"` as an argument in `memoize` (#998)
-- Give a better error messsage when `auto` dependency checking fails (#994)
-- Various doc updates (#936, #956, #979, #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 now properly stop execution when an error occurs (#988, #993)
-- Various doc fixes (#971, #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 of running tasks (#637)
-- Added `queue#workersList()`, to retrieve the list of currently running tasks. (#891)
-- Various code simplifications (#896, #904)
-- Various doc fixes :scroll: (#890, #894, #903, #905, #912)
-
-# v1.4.2
-
-- Ensure coverage files don't get published on npm (#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)
-
-# 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)
-- Code simplifications and optimizations aplenty ([diff](https://github.com/caolan/async/compare/v1.3.0...v1.4.0))
-
-
-# v1.3.0
-
-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)
-
-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)
-
-
-# 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)
-
-
-# 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)
-
-Bug Fixes:
-
-- Fixed a regression in `each` and family with empty arrays that have additional properties. (#775, #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)
-
-
-# v1.1.0
-
-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)
-- 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)
-- Reduced file size by 4kb, (minified version by 1kb)
-- Added code coverage through `nyc` and `coveralls` (#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)
-
-
-# v1.0.0
-
-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)
-- Optimize internal `_each`, `_map` and `_keys` functions.
diff --git a/build/LICENSE b/build/LICENSE
deleted file mode 100644
index 9fe85b9..0000000
--- a/build/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2010-2016 Caolan McMahon
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/build/README.md b/build/README.md
deleted file mode 100644
index 70f68f0..0000000
--- a/build/README.md
+++ /dev/null
@@ -1,1888 +0,0 @@
-**NOTE: This is the README for Async 2.0, currently under development. For docs for async@1.5.2 go [HERE](https://github.com/caolan/async/blob/v1.5.2/README.md).
-
-# Async.js v2.0.0-pre
-
-[![Build Status via Travis CI](https://travis-ci.org/caolan/async.svg?branch=master)](https://travis-ci.org/caolan/async)
-[![NPM version](http://img.shields.io/npm/v/async.svg)](https://www.npmjs.org/package/async)
-[![Coverage Status](https://coveralls.io/repos/caolan/async/badge.svg?branch=master)](https://coveralls.io/r/caolan/async?branch=master)
-[![Join the chat at https://gitter.im/caolan/async](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/caolan/async?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-
-
-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 async`,
-it can also be used directly in the browser.
-
-Async is also installable via:
-
-- [bower](http://bower.io/): `bower install async`
-- [component](https://github.com/component/component): `component install caolan/async`
-- [jam](http://jamjs.org/): `jam install async`
-- [spm](http://spmjs.io/): `spm install async`
-
-Async provides around 20 functions that include the usual 'functional'
-suspects (`map`, `reduce`, `filter`, `each`…) as well as some common patterns
-for asynchronous control flow (`parallel`, `series`, `waterfall`…). All these
-functions assume you follow the Node.js convention of providing a single
-callback as the last argument of your `async` function.
-
-
-## Quick Examples
-
-```js
-async.map(['file1','file2','file3'], fs.stat, function(err, results){
- // results is now an array of stats for each file
-});
-
-async.filter(['file1','file2','file3'], function(filePath, callback) {
- fs.access(filePath, function(err) {
- callback(null, !err)
- });
-}, function(err, results){
- // results now equals an array of the existing files
-});
-
-async.parallel([
- function(){ ... },
- function(){ ... }
-], callback);
-
-async.series([
- function(){ ... },
- function(){ ... }
-]);
-```
-
-There are many more functions available so take a look at the docs below for a
-full list. This module aims to be comprehensive, so if you feel anything is
-missing please create a GitHub issue for it.
-
-## Common Pitfalls <sub>[(StackOverflow)](http://stackoverflow.com/questions/tagged/async.js)</sub>
-### Synchronous iteration functions
-
-If you get an error like `RangeError: Maximum call stack size exceeded.` or other stack overflow issues when using async, you are likely using a synchronous iteratee. By *synchronous* we mean a function that calls its callback on the same tick in the javascript event loop, without doing any I/O or using any timers. Calling many callbacks iteratively will quickly overflow the stack. If you run into this issue, just defer your callback with `async.setImmediate` to start a new call stack on the next tick of the event loop.
-
-This can also arise by accident if you callback early in certain cases:
-
-```js
-async.eachSeries(hugeArray, function iteratee(item, callback) {
- if (inCache(item)) {
- callback(null, cache[item]); // if many items are cached, you'll overflow
- } else {
- doSomeIO(item, callback);
- }
-}, function done() {
- //...
-});
-```
-
-Just change it to:
-
-```js
-async.eachSeries(hugeArray, function iteratee(item, callback) {
- if (inCache(item)) {
- async.setImmediate(function () {
- callback(null, cache[item]);
- });
- } else {
- doSomeIO(item, callback);
- //...
-```
-
-Async guards against synchronous functions in some, but not all, cases. If you are still running into stack overflows, you can defer as suggested above, or wrap functions with [`async.ensureAsync`](#ensureAsync) Functions that are asynchronous by their nature do not have this problem and don't need the extra callback deferral.
-
-If JavaScript's event loop is still a bit nebulous, check out [this article](http://blog.carbonfive.com/2013/10/27/the-javascript-event-loop-explained/) or [this talk](http://2014.jsconf.eu/speakers/philip-roberts-what-the-heck-is-the-event-loop-anyway.html) for more detailed information about how it works.
-
-
-### Multiple callbacks
-
-Make sure to always `return` when calling a callback early, otherwise you will cause multiple callbacks and unpredictable behavior in many cases.
-
-```js
-async.waterfall([
- function (callback) {
- getSomething(options, function (err, result) {
- if (err) {
- callback(new Error("failed getting something:" + err.message));
- // we should return here
- }
- // since we did not return, this callback still will be called and
- // `processData` will be called twice
- callback(null, result);
- });
- },
- processData
-], done)
-```
-
-It is always good practice to `return callback(err, result)` whenever a callback call is not the last statement of a function.
-
-
-### Binding a context to an iteratee
-
-This section is really about `bind`, not about `async`. If you are wondering how to
-make `async` execute your iteratees in a given context, or are confused as to why
-a method of another library isn't working as an iteratee, study this example:
-
-```js
-// Here is a simple object with an (unnecessarily roundabout) squaring method
-var AsyncSquaringLibrary = {
- squareExponent: 2,
- square: function(number, callback){
- var result = Math.pow(number, this.squareExponent);
- setTimeout(function(){
- callback(null, result);
- }, 200);
- }
-};
-
-async.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){
- // result is [NaN, NaN, NaN]
- // This fails because the `this.squareExponent` expression in the square
- // function is not evaluated in the context of AsyncSquaringLibrary, and is
- // therefore undefined.
-});
-
-async.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){
- // result is [1, 4, 9]
- // With the help of bind we can attach a context to the iteratee before
- // passing it to async. Now the square function will be executed in its
- // 'home' AsyncSquaringLibrary context and the value of `this.squareExponent`
- // will be as expected.
-});
-```
-
-## Download
-
-The source is available for download from
-[GitHub](https://github.com/caolan/async/blob/master/lib/async.js).
-Alternatively, you can install using Node Package Manager (`npm`):
-
- npm install async
-
-As well as using Bower:
-
- bower install async
-
-__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed
-
-## In the Browser
-
-So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5.
-
-Usage:
-
-```html
-<script type="text/javascript" src="async.js"></script>
-<script type="text/javascript">
-
- async.map(data, asyncProcess, function(err, results){
- alert(results);
- });
-
-</script>
-```
-
-## Documentation
-
-Some functions are also available in the following forms:
-* `<name>Series` - the same as `<name>` but runs only a single async operation at a time
-* `<name>Limit` - the same as `<name>` but runs a maximum of `limit` async operations at a time
-
-### Collections
-
-* [`each`](#each), `eachSeries`, `eachLimit`
-* [`forEachOf`](#forEachOf), `forEachOfSeries`, `forEachOfLimit`
-* [`map`](#map), `mapSeries`, `mapLimit`
-* [`filter`](#filter), `filterSeries`, `filterLimit`
-* [`reject`](#reject), `rejectSeries`, `rejectLimit`
-* [`reduce`](#reduce), [`reduceRight`](#reduceRight)
-* [`detect`](#detect), `detectSeries`, `detectLimit`
-* [`sortBy`](#sortBy)
-* [`some`](#some), `someLimit`
-* [`every`](#every), `everyLimit`
-* [`concat`](#concat), `concatSeries`
-
-### Control Flow
-
-* [`series`](#seriestasks-callback)
-* [`parallel`](#parallel), `parallelLimit`
-* [`whilst`](#whilst), [`doWhilst`](#doWhilst)
-* [`until`](#until), [`doUntil`](#doUntil)
-* [`during`](#during), [`doDuring`](#doDuring)
-* [`forever`](#forever)
-* [`waterfall`](#waterfall)
-* [`compose`](#compose)
-* [`seq`](#seq)
-* [`applyEach`](#applyEach), `applyEachSeries`
-* [`queue`](#queue), [`priorityQueue`](#priorityQueue)
-* [`cargo`](#cargo)
-* [`auto`](#auto)
-* [`retry`](#retry)
-* [`iterator`](#iterator)
-* [`times`](#times), `timesSeries`, `timesLimit`
-
-### Utils
-
-* [`apply`](#apply)
-* [`nextTick`](#nextTick)
-* [`memoize`](#memoize)
-* [`unmemoize`](#unmemoize)
-* [`ensureAsync`](#ensureAsync)
-* [`constant`](#constant)
-* [`asyncify`](#asyncify)
-* [`wrapSync`](#wrapSync)
-* [`log`](#log)
-* [`dir`](#dir)
-* [`noConflict`](#noConflict)
-
-## Collections
-
-<a name="forEach"></a>
-<a name="each"></a>
-### each(arr, iteratee, [callback])
-
-Applies the function `iteratee` to each item in `arr`, in parallel.
-The `iteratee` is called with an item from the list, and a callback for when it
-has finished. If the `iteratee` passes an error to its `callback`, the main
-`callback` (for the `each` function) is immediately called with the error.
-
-Note, that since this function applies `iteratee` to each item in parallel,
-there is no guarantee that the iteratee functions will complete in order.
-
-__Arguments__
-
-* `arr` - An array to iterate over.
-* `iteratee(item, callback)` - A function to apply to each item in `arr`.
- The iteratee is passed a `callback(err)` which must be called once it has
- completed. If no error has occurred, the `callback` should be run without
- arguments or with an explicit `null` argument. The array index is not passed
- to the iteratee. If you need the index, use [`forEachOf`](#forEachOf).
-* `callback(err)` - *Optional* A callback which is called when all `iteratee` functions
- have finished, or an error occurs.
-
-__Examples__
-
-
-```js
-// assuming openFiles is an array of file names and saveFile is a function
-// to save the modified contents of that file:
-
-async.each(openFiles, saveFile, function(err){
- // if any of the saves produced an error, err would equal that error
-});
-```
-
-```js
-// assuming openFiles is an array of file names
-
-async.each(openFiles, function(file, callback) {
-
- // Perform operation on file here.
- console.log('Processing file ' + file);
-
- if( file.length > 32 ) {
- console.log('This file name is too long');
- callback('File name too long');
- } else {
- // Do work to process file here
- console.log('File processed');
- callback();
- }
-}, function(err){
- // if any of the file processing produced an error, err would equal that error
- if( err ) {
- // One of the iterations produced an error.
- // All processing will now stop.
- console.log('A file failed to process');
- } else {
- console.log('All files have been processed successfully');
- }
-});
-```
-
-__Related__
-
-* eachSeries(arr, iteratee, [callback])
-* eachLimit(arr, limit, iteratee, [callback])
-
----------------------------------------
-
-<a name="forEachOf"></a>
-<a name="eachOf"></a>
-### forEachOf(obj, iteratee, [callback])
-
-Like `each`, except that it iterates over objects, and passes the key as the second argument to the iteratee.
-
-__Arguments__
-
-* `obj` - An object or array to iterate over.
-* `iteratee(item, key, callback)` - A function to apply to each item in `obj`.
-The `key` is the item's key, or index in the case of an array. The iteratee is
-passed a `callback(err)` which must be called once it has completed. If no
-error has occurred, the callback should be run without arguments or with an
-explicit `null` argument.
-* `callback(err)` - *Optional* A callback which is called when all `iteratee` functions have finished, or an error occurs.
-
-__Example__
-
-```js
-var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"};
-var configs = {};
-
-async.forEachOf(obj, function (value, key, callback) {
- fs.readFile(__dirname + value, "utf8", function (err, data) {
- if (err) return callback(err);
- try {
- configs[key] = JSON.parse(data);
- } catch (e) {
- return callback(e);
- }
- callback();
- });
-}, function (err) {
- if (err) console.error(err.message);
- // configs is now a map of JSON data
- doSomethingWith(configs);
-})
-```
-
-__Related__
-
-* forEachOfSeries(obj, iteratee, [callback])
-* forEachOfLimit(obj, limit, iteratee, [callback])
-
----------------------------------------
-
-<a name="map"></a>
-### map(arr, iteratee, [callback])
-
-Produces a new array of values by mapping each value in `arr` through
-the `iteratee` function. The `iteratee` is called with an item from `arr` and a
-callback for when it has finished processing. Each of these callback takes 2 arguments:
-an `error`, and the transformed item from `arr`. If `iteratee` passes an error to its
-callback, the main `callback` (for the `map` function) is immediately called with the error.
-
-Note, that since this function applies the `iteratee` to each item in parallel,
-there is no guarantee that the `iteratee` functions will complete in order.
-However, the results array will be in the same order as the original `arr`.
-
-__Arguments__
-
-* `arr` - An array to iterate over.
-* `iteratee(item, callback)` - A function to apply to each item in `arr`.
- The iteratee is passed a `callback(err, transformed)` which must be called once
- it has completed with an error (which can be `null`) and a transformed item.
-* `callback(err, results)` - *Optional* A callback which is called when all `iteratee`
- functions have finished, or an error occurs. Results is an array of the
- transformed items from the `arr`.
-
-__Example__
-
-```js
-async.map(['file1','file2','file3'], fs.stat, function(err, results){
- // results is now an array of stats for each file
-});
-```
-
-__Related__
-
-* mapSeries(arr, iteratee, [callback])
-* mapLimit(arr, limit, iteratee, [callback])
-
----------------------------------------
-
-<a name="select"></a>
-<a name="filter"></a>
-### filter(arr, iteratee, [callback])
-
-__Alias:__ `select`
-
-Returns a new array of all the values in `arr` which pass an async truth test.
-This operation is performed in parallel,
-but the results array will be in the same order as the original.
-
-__Arguments__
-
-* `arr` - An array to iterate over.
-* `iteratee(item, callback)` - A truth test to apply to each item in `arr`.
- The `iteratee` is passed a `callback(err, truthValue)`, which must be called with a
- boolean argument once it has completed.
-* `callback(err, results)` - *Optional* A callback which is called after all the `iteratee`
- functions have finished.
-
-__Example__
-
-```js
-async.filter(['file1','file2','file3'], function(filePath, callback) {
- fs.access(filePath, function(err) {
- callback(null, !err)
- });
-}, function(err, results){
- // results now equals an array of the existing files
-});
-```
-
-__Related__
-
-* filterSeries(arr, iteratee, [callback])
-* filterLimit(arr, limit, iteratee, [callback])
-
----------------------------------------
-
-<a name="reject"></a>
-### reject(arr, iteratee, [callback])
-
-The opposite of [`filter`](#filter). Removes values that pass an `async` truth test.
-
-__Related__
-
-* rejectSeries(arr, iteratee, [callback])
-* rejectLimit(arr, limit, iteratee, [callback])
-
----------------------------------------
-
-<a name="reduce"></a>
-### reduce(arr, memo, iteratee, [callback])
-
-__Aliases:__ `inject`, `foldl`
-
-Reduces `arr` into a single value using an async `iteratee` to return
-each successive step. `memo` is the initial state of the reduction.
-This function only operates in series.
-
-For performance reasons, it may make sense to split a call to this function into
-a parallel map, and then use the normal `Array.prototype.reduce` on the results.
-This function is for situations where each step in the reduction needs to be async;
-if you can get the data before reducing it, then it's probably a good idea to do so.
-
-__Arguments__
-
-* `arr` - An array to iterate over.
-* `memo` - The initial state of the reduction.
-* `iteratee(memo, item, callback)` - A function applied to each item in the
- array to produce the next step in the reduction. The `iteratee` is passed a
- `callback(err, reduction)` which accepts an optional error as its first
- argument, and the state of the reduction as the second. If an error is
- passed to the callback, the reduction is stopped and the main `callback` is
- immediately called with the error.
-* `callback(err, result)` - *Optional* A callback which is called after all the `iteratee`
- functions have finished. Result is the reduced value.
-
-__Example__
-
-```js
-async.reduce([1,2,3], 0, function(memo, item, callback){
- // pointless async:
- process.nextTick(function(){
- callback(null, memo + item)
- });
-}, function(err, result){
- // result is now equal to the last value of memo, which is 6
-});
-```
-
----------------------------------------
-
-<a name="reduceRight"></a>
-### reduceRight(arr, memo, iteratee, [callback])
-
-__Alias:__ `foldr`
-
-Same as [`reduce`](#reduce), only operates on `arr` in reverse order.
-
----------------------------------------
-
-<a name="detect"></a>
-### detect(arr, iteratee, [callback])
-
-Returns the first value in `arr` that passes an async truth test. The
-`iteratee` is applied in parallel, meaning the first iteratee to return `true` will
-fire the detect `callback` with that result. That means the result might not be
-the first item in the original `arr` (in terms of order) that passes the test.
-
-If order within the original `arr` is important, then look at `detectSeries`.
-
-__Arguments__
-
-* `arr` - An array to iterate over.
-* `iteratee(item, callback)` - A truth test to apply to each item in `arr`.
- The iteratee is passed a `callback(err, truthValue)` which must be called with a
- boolean argument once it has completed.
-* `callback(err, result)` - *Optional* A callback which is called as soon as any iteratee returns
- `true`, or after all the `iteratee` functions have finished. Result will be
- the first item in the array that passes the truth test (iteratee) or the
- value `undefined` if none passed.
-
-__Example__
-
-```js
-async.detect(['file1','file2','file3'], function(filePath, callback) {
- fs.access(filePath, function(err) {
- callback(null, !err)
- });
-}, function(err, result){
- // result now equals the first file in the list that exists
-});
-```
-
-__Related__
-
-* detectSeries(arr, iteratee, [callback])
-* detectLimit(arr, limit, iteratee, [callback])
-
----------------------------------------
-
-<a name="sortBy"></a>
-### sortBy(arr, iteratee, [callback])
-
-Sorts a list by the results of running each `arr` value through an async `iteratee`.
-
-__Arguments__
-
-* `arr` - An array to iterate over.
-* `iteratee(item, callback)` - A function to apply to each item in `arr`.
- The iteratee is passed a `callback(err, sortValue)` which must be called once it
- has completed with an error (which can be `null`) and a value to use as the sort
- criteria.
-* `callback(err, results)` - *Optional* A callback which is called after all the `iteratee`
- functions have finished, or an error occurs. Results is the items from
- the original `arr` sorted by the values returned by the `iteratee` calls.
-
-__Example__
-
-```js
-async.sortBy(['file1','file2','file3'], function(file, callback){
- fs.stat(file, function(err, stats){
- callback(err, stats.mtime);
- });
-}, function(err, results){
- // results is now the original array of files sorted by
- // modified date
-});
-```
-
-__Sort Order__
-
-By modifying the callback parameter the sorting order can be influenced:
-
-```js
-//ascending order
-async.sortBy([1,9,3,5], function(x, callback){
- callback(null, x);
-}, function(err,result){
- //result callback
-} );
-
-//descending order
-async.sortBy([1,9,3,5], function(x, callback){
- callback(null, x*-1); //<- x*-1 instead of x, turns the order around
-}, function(err,result){
- //result callback
-} );
-```
-
----------------------------------------
-
-<a name="some"></a>
-### some(arr, iteratee, [callback])
-
-__Alias:__ `any`
-
-Returns `true` if at least one element in the `arr` satisfies an async test.
-If any iteratee call returns `true`, the main `callback` is immediately called.
-
-__Arguments__
-
-* `arr` - An array to iterate over.
-* `iteratee(item, callback)` - A truth test to apply to each item in the array
- in parallel. The iteratee is passed a `callback(truthValue)`` which must be
- called with a boolean argument once it has completed.
-* `callback(err, result)` - *Optional* A callback which is called as soon as any iteratee returns
- `true`, or after all the iteratee functions have finished. Result will be
- either `true` or `false` depending on the values of the async tests.
-
-__Example__
-
-```js
-async.some(['file1','file2','file3'], function(filePath, callback) {
- fs.access(filePath, function(err) {
- callback(null, !err)
- });
-}, function(err, result){
- // if result is true then at least one of the files exists
-});
-```
-
-__Related__
-
-* someLimit(arr, limit, iteratee, callback)
-
----------------------------------------
-
-<a name="every"></a>
-### every(arr, iteratee, [callback])
-
-__Alias:__ `all`
-
-Returns `true` if every element in `arr` satisfies an async test.
-If any iteratee call returns `false`, the main `callback` is immediately called.
-
-__Arguments__
-
-* `arr` - An array to iterate over.
-* `iteratee(item, callback)` - A truth test to apply to each item in the array
- in parallel. The iteratee is passed a `callback(err, truthValue)` which must be
- called with a boolean argument once it has completed.
-* `callback(err, result)` - *Optional* A callback which is called after all the `iteratee`
- functions have finished. Result will be either `true` or `false` depending on
- the values of the async tests.
-
-__Example__
-
-```js
-async.every(['file1','file2','file3'], function(filePath, callback) {
- fs.access(filePath, function(err) {
- callback(null, !err)
- });
-}, function(err, result){
- // if result is true then every file exists
-});
-```
-
-__Related__
-
-* everyLimit(arr, limit, iteratee, callback)
-
----------------------------------------
-
-<a name="concat"></a>
-### concat(arr, iteratee, [callback])
-
-Applies `iteratee` to each item in `arr`, concatenating the results. Returns the
-concatenated list. The `iteratee`s are called in parallel, and the results are
-concatenated as they return. There is no guarantee that the results array will
-be returned in the original order of `arr` passed to the `iteratee` function.
-
-__Arguments__
-
-* `arr` - An array to iterate over.
-* `iteratee(item, callback)` - A function to apply to each item in `arr`.
- The iteratee is passed a `callback(err, results)` which must be called once it
- has completed with an error (which can be `null`) and an array of results.
-* `callback(err, results)` - *Optional* A callback which is called after all the `iteratee`
- functions have finished, or an error occurs. Results is an array containing
- the concatenated results of the `iteratee` function.
-
-__Example__
-
-```js
-async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){
- // files is now a list of filenames that exist in the 3 directories
-});
-```
-
-__Related__
-
-* concatSeries(arr, iteratee, [callback])
-
-
-## Control Flow
-
-<a name="series"></a>
-### series(tasks, [callback])
-
-Run the functions in the `tasks` array in series, each one running once the previous
-function has completed. If any functions in the series pass an error to its
-callback, no more functions are run, and `callback` is immediately called with the value of the error.
-Otherwise, `callback` receives an array of results when `tasks` have completed.
-
-It is also possible to use an object instead of an array. Each property will be
-run as a function, and the results will be passed to the final `callback` as an object
-instead of an array. This can be a more readable way of handling results from
-[`series`](#series).
-
-**Note** that while many implementations preserve the order of object properties, the
-[ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6)
-explicitly states that
-
-> The mechanics and order of enumerating the properties is not specified.
-
-So if you rely on the order in which your series of functions are executed, and want
-this to work on all platforms, consider using an array.
-
-__Arguments__
-
-* `tasks` - An array or object 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.
-* `callback(err, results)` - An optional callback to run once all the functions
- have completed. This function gets a results array (or object) containing all
- the result arguments passed to the `task` callbacks.
-
-__Example__
-
-```js
-async.series([
- function(callback){
- // do some stuff ...
- callback(null, 'one');
- },
- function(callback){
- // do some more stuff ...
- callback(null, 'two');
- }
-],
-// optional callback
-function(err, results){
- // results is now equal to ['one', 'two']
-});
-
-
-// an example using an object instead of an array
-async.series({
- one: function(callback){
- setTimeout(function(){
- callback(null, 1);
- }, 200);
- },
- two: function(callback){
- setTimeout(function(){
- callback(null, 2);
- }, 100);
- }
-},
-function(err, results) {
- // results is now equal to: {one: 1, two: 2}
-});
-```
-
----------------------------------------
-
-<a name="parallel"></a>
-### parallel(tasks, [callback])
-
-Run the `tasks` array of functions in parallel, without waiting until the previous
-function has completed. If any of the functions pass an error to its
-callback, the main `callback` is immediately called with the value of the error.
-Once the `tasks` have completed, the results are passed to the final `callback` as an
-array.
-
-**Note:** `parallel` is about kicking-off I/O tasks in parallel, not about parallel execution of code. If your tasks do not use any timers or perform any I/O, they will actually be executed in series. Any synchronous setup sections for each task will happen one after the other. JavaScript remains single-threaded.
-
-It is also possible to use an object instead of an array. Each property will be
-run as a function and the results will be passed to the final `callback` as an object
-instead of an array. This can be a more readable way of handling results from
-[`parallel`](#parallel).
-
-
-__Arguments__
-
-* `tasks` - An array or object containing functions to run. Each function is passed
- a `callback(err, result)` which it must call on completion with an error `err`
- (which can be `null`) and an optional `result` value.
-* `callback(err, results)` - An optional callback to run once all the functions
- have completed successfully. This function gets a results array (or object) containing all
- the result arguments passed to the task callbacks.
-
-__Example__
-
-```js
-async.parallel([
- function(callback){
- setTimeout(function(){
- callback(null, 'one');
- }, 200);
- },
- function(callback){
- setTimeout(function(){
- callback(null, 'two');
- }, 100);
- }
-],
-// optional callback
-function(err, results){
- // the results array will equal ['one','two'] even though
- // the second function had a shorter timeout.
-});
-
-
-// an example using an object instead of an array
-async.parallel({
- one: function(callback){
- setTimeout(function(){
- callback(null, 1);
- }, 200);
- },
- two: function(callback){
- setTimeout(function(){
- callback(null, 2);
- }, 100);
- }
-},
-function(err, results) {
- // results is now equals to: {one: 1, two: 2}
-});
-```
-
-__Related__
-
-* parallelLimit(tasks, limit, [callback])
-
----------------------------------------
-
-<a name="whilst"></a>
-### whilst(test, fn, callback)
-
-Repeatedly call `fn`, while `test` returns `true`. Calls `callback` when stopped,
-or an error occurs.
-
-__Arguments__
-
-* `test()` - synchronous truth test to perform before each execution of `fn`.
-* `fn(callback)` - A function which is called each time `test` passes. The function is
- passed a `callback(err)`, which must be called once it has completed with an
- optional `err` argument.
-* `callback(err, [results])` - A callback which is called after the test
- function has failed and repeated execution of `fn` has stopped. `callback`
- will be passed an error and any arguments passed to the final `fn`'s callback.
-
-__Example__
-
-```js
-var count = 0;
-
-async.whilst(
- function () { return count < 5; },
- function (callback) {
- count++;
- setTimeout(function () {
- callback(null, count);
- }, 1000);
- },
- function (err, n) {
- // 5 seconds have passed, n = 5
- }
-);
-```
-
----------------------------------------
-
-<a name="doWhilst"></a>
-### doWhilst(fn, test, callback)
-
-The post-check version of [`whilst`](#whilst). To reflect the difference in
-the order of operations, the arguments `test` and `fn` are switched.
-
-`doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.
-
----------------------------------------
-
-<a name="until"></a>
-### until(test, fn, callback)
-
-Repeatedly call `fn` until `test` returns `true`. Calls `callback` when stopped,
-or an error occurs. `callback` will be passed an error and any arguments passed
-to the final `fn`'s callback.
-
-The inverse of [`whilst`](#whilst).
-
----------------------------------------
-
-<a name="doUntil"></a>
-### doUntil(fn, test, callback)
-
-Like [`doWhilst`](#doWhilst), except the `test` is inverted. Note the argument ordering differs from `until`.
-
----------------------------------------
-
-<a name="during"></a>
-### during(test, fn, callback)
-
-Like [`whilst`](#whilst), except the `test` is an asynchronous function that is passed a callback in the form of `function (err, truth)`. If error is passed to `test` or `fn`, the main callback is immediately called with the value of the error.
-
-__Example__
-
-```js
-var count = 0;
-
-async.during(
- function (callback) {
- return callback(null, count < 5);
- },
- function (callback) {
- count++;
- setTimeout(callback, 1000);
- },
- function (err) {
- // 5 seconds have passed
- }
-);
-```
-
----------------------------------------
-
-<a name="doDuring"></a>
-### doDuring(fn, test, callback)
-
-The post-check version of [`during`](#during). To reflect the difference in
-the order of operations, the arguments `test` and `fn` are switched.
-
-Also a version of [`doWhilst`](#doWhilst) with asynchronous `test` function.
-
----------------------------------------
-
-<a name="forever"></a>
-### forever(fn, [errback])
-
-Calls the asynchronous function `fn` with a callback parameter that allows it to
-call itself again, in series, indefinitely.
-
-If an error is passed to the callback then `errback` is called with the
-error, and execution stops, otherwise it will never be called.
-
-```js
-async.forever(
- function(next) {
- // next is suitable for passing to things that need a callback(err [, whatever]);
- // it will result in this function being called again.
- },
- function(err) {
- // if next is called with a value in its first parameter, it will appear
- // in here as 'err', and execution will stop.
- }
-);
-```
-
----------------------------------------
-
-<a name="waterfall"></a>
-### waterfall(tasks, [callback])
-
-Runs the `tasks` array of functions in series, each passing their results to the next in
-the array. However, if any of the `tasks` pass an error to their own callback, the
-next function is not executed, and the main `callback` is immediately called with
-the error.
-
-__Arguments__
-
-* `tasks` - An array of functions to run, each function is passed a
- `callback(err, result1, result2, ...)` it must call on completion. The first
- argument is an error (which can be `null`) and any further arguments will be
- passed as arguments in order to the next task.
-* `callback(err, [results])` - An optional callback to run once all the functions
- have completed. This will be passed the results of the last task's callback.
-
-
-
-__Example__
-
-```js
-async.waterfall([
- function(callback) {
- callback(null, 'one', 'two');
- },
- function(arg1, arg2, callback) {
- // arg1 now equals 'one' and arg2 now equals 'two'
- callback(null, 'three');
- },
- function(arg1, callback) {
- // arg1 now equals 'three'
- callback(null, 'done');
- }
-], function (err, result) {
- // result now equals 'done'
-});
-```
-Or, with named functions:
-
-```js
-async.waterfall([
- myFirstFunction,
- mySecondFunction,
- myLastFunction,
-], function (err, result) {
- // result now equals 'done'
-});
-function myFirstFunction(callback) {
- callback(null, 'one', 'two');
-}
-function mySecondFunction(arg1, arg2, callback) {
- // arg1 now equals 'one' and arg2 now equals 'two'
- callback(null, 'three');
-}
-function myLastFunction(arg1, callback) {
- // arg1 now equals 'three'
- callback(null, 'done');
-}
-```
-
-Or, if you need to pass any argument to the first function:
-
-```js
-async.waterfall([
- async.apply(myFirstFunction, 'zero'),
- mySecondFunction,
- myLastFunction,
-], function (err, result) {
- // result now equals 'done'
-});
-function myFirstFunction(arg1, callback) {
- // arg1 now equals 'zero'
- callback(null, 'one', 'two');
-}
-function mySecondFunction(arg1, arg2, callback) {
- // arg1 now equals 'one' and arg2 now equals 'two'
- callback(null, 'three');
-}
-function myLastFunction(arg1, callback) {
- // arg1 now equals 'three'
- callback(null, 'done');
-}
-```
-
----------------------------------------
-
-<a name="compose"></a>
-### compose(fn1, fn2...)
-
-Creates a function which is a composition of the passed asynchronous
-functions. Each function consumes the return value of the function that
-follows. Composing functions `f()`, `g()`, and `h()` would produce the result of
-`f(g(h()))`, only this version uses callbacks to obtain the return values.
-
-Each function is executed with the `this` binding of the composed function.
-
-__Arguments__
-
-* `functions...` - the asynchronous functions to compose
-
-
-__Example__
-
-```js
-function add1(n, callback) {
- setTimeout(function () {
- callback(null, n + 1);
- }, 10);
-}
-
-function mul3(n, callback) {
- setTimeout(function () {
- callback(null, n * 3);
- }, 10);
-}
-
-var add1mul3 = async.compose(mul3, add1);
-
-add1mul3(4, function (err, result) {
- // result now equals 15
-});
-```
-
----------------------------------------
-
-<a name="seq"></a>
-### seq(fn1, fn2...)
-
-Version of the compose function that is more natural to read.
-Each function consumes the return value of the previous function.
-It is the equivalent of [`compose`](#compose) with the arguments reversed.
-
-Each function is executed with the `this` binding of the composed function.
-
-__Arguments__
-
-* `functions...` - the asynchronous functions to compose
-
-
-__Example__
-
-```js
-// Requires lodash (or underscore), express3 and dresende's orm2.
-// Part of an app, that fetches cats of the logged user.
-// This example uses `seq` function to avoid overnesting and error
-// handling clutter.
-app.get('/cats', function(request, response) {
- var User = request.models.User;
- async.seq(
- _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data))
- function(user, fn) {
- user.getCats(fn); // 'getCats' has signature (callback(err, data))
- }
- )(req.session.user_id, function (err, cats) {
- if (err) {
- console.error(err);
- response.json({ status: 'error', message: err.message });
- } else {
- response.json({ status: 'ok', message: 'Cats found', data: cats });
- }
- });
-});
-```
-
----------------------------------------
-
-<a name="applyEach"></a>
-### applyEach(fns, args..., callback)
-
-Applies the provided arguments to each function in the array, calling
-`callback` after all functions have completed. If you only provide the first
-argument, then it will return a function which lets you pass in the
-arguments as if it were a single function call.
-
-__Arguments__
-
-* `fns` - the asynchronous functions to all call with the same arguments
-* `args...` - any number of separate arguments to pass to the function
-* `callback` - the final argument should be the callback, called when all
- functions have completed processing
-
-
-__Example__
-
-```js
-async.applyEach([enableSearch, updateSchema], 'bucket', callback);
-
-// partial application example:
-async.each(
- buckets,
- async.applyEach([enableSearch, updateSchema]),
- callback
-);
-```
-
-__Related__
-
-* applyEachSeries(tasks, args..., [callback])
-
----------------------------------------
-
-<a name="queue"></a>
-### queue(worker, [concurrency])
-
-Creates a `queue` object with the specified `concurrency`. Tasks added to the
-`queue` are processed in parallel (up to the `concurrency` limit). If all
-`worker`s are in progress, the task is queued until one becomes available.
-Once a `worker` completes a `task`, that `task`'s callback is called.
-
-__Arguments__
-
-* `worker(task, callback)` - An asynchronous function for processing a queued
- task, which must call its `callback(err)` argument when finished, with an
- optional `error` as an argument. If you want to handle errors from an individual task, pass a callback to `q.push()`.
-* `concurrency` - An `integer` for determining how many `worker` functions should be
- run in parallel. If omitted, the concurrency defaults to `1`. If the concurrency is `0`, an error is thrown.
-
-__Queue objects__
-
-The `queue` object returned by this function has the following properties and
-methods:
-
-* `length()` - a function returning the number of items waiting to be processed.
-* `started` - a function returning whether or not any items have been pushed and processed by the queue
-* `running()` - a function returning the number of items currently being processed.
-* `workersList()` - a function returning the array of items currently being processed.
-* `idle()` - a function returning false if there are items waiting or being processed, or true if not.
-* `concurrency` - an integer for determining how many `worker` functions should be
- run in parallel. This property can be changed after a `queue` is created to
- alter the concurrency on-the-fly.
-* `push(task, [callback])` - add a new task to the `queue`. Calls `callback` once
- the `worker` has finished processing the task. Instead of a single task, a `tasks` array
- can be submitted. The respective callback is used for every task in the list.
-* `unshift(task, [callback])` - add a new task to the front of the `queue`.
-* `saturated` - a callback that is called when the `queue` length hits the `concurrency` limit,
- and further tasks will be queued.
-* `empty` - a callback that is called when the last item from the `queue` is given to a `worker`.
-* `drain` - a callback that is called when the last item from the `queue` has returned from the `worker`.
-* `paused` - a boolean for determining whether the queue is in a paused state
-* `pause()` - a function that pauses the processing of tasks until `resume()` is called.
-* `resume()` - a function that resumes the processing of queued tasks when the queue is paused.
-* `kill()` - a function that removes the `drain` callback and empties remaining tasks from the queue forcing it to go idle.
-
-__Example__
-
-```js
-// create a queue object with concurrency 2
-
-var q = async.queue(function (task, callback) {
- console.log('hello ' + task.name);
- callback();
-}, 2);
-
-
-// assign a callback
-q.drain = function() {
- console.log('all items have been processed');
-}
-
-// add some items to the queue
-
-q.push({name: 'foo'}, function (err) {
- console.log('finished processing foo');
-});
-q.push({name: 'bar'}, function (err) {
- console.log('finished processing bar');
-});
-
-// add some items to the queue (batch-wise)
-
-q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) {
- console.log('finished processing item');
-});
-
-// add some items to the front of the queue
-
-q.unshift({name: 'bar'}, function (err) {
- console.log('finished processing bar');
-});
-```
-
----------------------------------------
-
-<a name="priorityQueue"></a>
-### priorityQueue(worker, concurrency)
-
-The same as [`queue`](#queue) only tasks are assigned a priority and completed in ascending priority order. There are two differences between `queue` and `priorityQueue` objects:
-
-* `push(task, priority, [callback])` - `priority` should be a number. If an array of
- `tasks` is given, all tasks will be assigned the same priority.
-* The `unshift` method was removed.
-
----------------------------------------
-
-<a name="cargo"></a>
-### cargo(worker, [payload])
-
-Creates a `cargo` object with the specified payload. Tasks added to the
-cargo will be processed altogether (up to the `payload` limit). If the
-`worker` is in progress, the task is queued until it becomes available. Once
-the `worker` has completed some tasks, each callback of those tasks is called.
-Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966) for how `cargo` and `queue` work.
-
-While [queue](#queue) passes only one task to one of a group of workers
-at a time, cargo passes an array of tasks to a single worker, repeating
-when the worker is finished.
-
-__Arguments__
-
-* `worker(tasks, callback)` - An asynchronous function for processing an array of
- queued tasks, which must call its `callback(err)` argument when finished, with
- an optional `err` argument.
-* `payload` - An optional `integer` for determining how many tasks should be
- processed per round; if omitted, the default is unlimited.
-
-__Cargo objects__
-
-The `cargo` object returned by this function has the following properties and
-methods:
-
-* `length()` - A function returning the number of items waiting to be processed.
-* `payload` - An `integer` for determining how many tasks should be
- process per round. This property can be changed after a `cargo` is created to
- alter the payload on-the-fly.
-* `push(task, [callback])` - Adds `task` to the `queue`. The callback is called
- once the `worker` has finished processing the task. Instead of a single task, an array of `tasks`
- can be submitted. The respective callback is used for every task in the list.
-* `saturated` - A callback that is called when the `queue.length()` hits the concurrency and further tasks will be queued.
-* `empty` - A callback that is called when the last item from the `queue` is given to a `worker`.
-* `drain` - A callback that is called when the last item from the `queue` has returned from the `worker`.
-* `idle()`, `pause()`, `resume()`, `kill()` - cargo inherits all of the same methods and event calbacks as [`queue`](#queue)
-
-__Example__
-
-```js
-// create a cargo object with payload 2
-
-var cargo = async.cargo(function (tasks, callback) {
- for(var i=0; i<tasks.length; i++){
- console.log('hello ' + tasks[i].name);
- }
- callback();
-}, 2);
-
-
-// add some items
-
-cargo.push({name: 'foo'}, function (err) {
- console.log('finished processing foo');
-});
-cargo.push({name: 'bar'}, function (err) {
- console.log('finished processing bar');
-});
-cargo.push({name: 'baz'}, function (err) {
- console.log('finished processing baz');
-});
-```
-
----------------------------------------
-
-<a name="auto"></a>
-### auto(tasks, [concurrency], [callback])
-
-Determines the best order for running the functions in `tasks`, based on their requirements. Each function can optionally depend on other functions being completed first, and each function is run as soon as its requirements are satisfied.
-
-If any of the functions pass an error to their callback, the `auto` sequence will stop. Further tasks will not execute (so any other functions depending on it will not run), and the main `callback` is immediately called with the error. Functions also receive an object containing the results of functions which have completed so far.
-
-Note, all functions are called with a `results` object as a second argument,
-so it is unsafe to pass functions in the `tasks` object which cannot handle the
-extra argument.
-
-For example, this snippet of code:
-
-```js
-async.auto({
- readData: async.apply(fs.readFile, 'data.txt', 'utf-8')
-}, callback);
-```
-
-will have the effect of calling `readFile` with the results object as the last
-argument, which will fail:
-
-```js
-fs.readFile('data.txt', 'utf-8', cb, {});
-```
-
-Instead, wrap the call to `readFile` in a function which does not forward the
-`results` object:
-
-```js
-async.auto({
- readData: function(cb, results){
- fs.readFile('data.txt', 'utf-8', cb);
- }
-}, callback);
-```
-
-__Arguments__
-
-* `tasks` - An object. Each of its properties is either a function or an array of
- requirements, with the function itself the last item in the array. The object's key
- of a property serves as the name of the task defined by that property,
- i.e. can be used when specifying requirements for other tasks.
- The function receives two arguments: (1) a `callback(err, result)` which must be
- called when finished, passing an `error` (which can be `null`) and the result of
- the function's execution, and (2) a `results` object, containing the results of
- the previously executed functions.
-* `concurrency` - An optional `integer` for determining the maximum number of tasks that can be run in parallel. By default, as many as possible.
-* `callback(err, results)` - An optional callback which is called when all the
- tasks have been completed. It receives the `err` argument if any `tasks`
- pass an error to their callback. Results are always returned; however, if
- an error occurs, no further `tasks` will be performed, and the results
- object will only contain partial results.
-
-__Example__
-
-```js
-async.auto({
- get_data: function(callback){
- console.log('in get_data');
- // async code to get some data
- callback(null, 'data', 'converted to array');
- },
- make_folder: function(callback){
- console.log('in make_folder');
- // async code to create a directory to store a file in
- // this is run at the same time as getting the data
- callback(null, 'folder');
- },
- write_file: ['get_data', 'make_folder', function(callback, results){
- console.log('in write_file', JSON.stringify(results));
- // once there is some data and the directory exists,
- // write the data to a file in the directory
- callback(null, 'filename');
- }],
- email_link: ['write_file', function(callback, results){
- console.log('in email_link', JSON.stringify(results));
- // once the file is written let's email a link to it...
- // results.write_file contains the filename returned by write_file.
- callback(null, {'file':results.write_file, 'email':'user@example.com'});
- }]
-}, function(err, results) {
- console.log('err = ', err);
- console.log('results = ', results);
-});
-```
-
-This is a fairly trivial example, but to do this using the basic parallel and
-series functions would look like this:
-
-```js
-async.parallel([
- function(callback){
- console.log('in get_data');
- // async code to get some data
- callback(null, 'data', 'converted to array');
- },
- function(callback){
- console.log('in make_folder');
- // async code to create a directory to store a file in
- // this is run at the same time as getting the data
- callback(null, 'folder');
- }
-],
-function(err, results){
- async.series([
- function(callback){
- console.log('in write_file', JSON.stringify(results));
- // once there is some data and the directory exists,
- // write the data to a file in the directory
- results.push('filename');
- callback(null);
- },
- function(callback){
- console.log('in email_link', JSON.stringify(results));
- // once the file is written let's email a link to it...
- callback(null, {'file':results.pop(), 'email':'user@example.com'});
- }
- ]);
-});
-```
-
-For a complicated series of `async` tasks, using the [`auto`](#auto) function makes adding
-new tasks much easier (and the code more readable).
-
----------------------------------------
-
-<a name="retry"></a>
-### retry([opts = {times: 5, interval: 0}| 5], task, [callback])
-
-Attempts to get a successful response from `task` no more than `times` times before
-returning an error. If the task is successful, the `callback` will be passed the result
-of the successful task. If all attempts fail, the callback will be passed the error and
-result (if any) of the final attempt.
-
-__Arguments__
-
-* `opts` - Can be either an object with `times` and `interval` or a number.
- * `times` - The number of attempts to make before giving up. The default is `5`.
- * `interval` - The time to wait between retries, in milliseconds. The default is `0`.
- * If `opts` is a number, the number specifies the number of times to retry, with the default interval of `0`.
-* `task(callback, results)` - A function which receives two arguments: (1) a `callback(err, result)`
- which must be called when finished, passing `err` (which can be `null`) and the `result` of
- the function's execution, and (2) a `results` object, containing the results of
- the previously executed functions (if nested inside another control flow).
-* `callback(err, results)` - An optional callback which is called when the
- task has succeeded, or after the final failed attempt. It receives the `err` and `result` arguments of the last attempt at completing the `task`.
-
-The [`retry`](#retry) function can be used as a stand-alone control flow by passing a callback, as shown below:
-
-```js
-// try calling apiMethod 3 times
-async.retry(3, apiMethod, function(err, result) {
- // do something with the result
-});
-```
-
-```js
-// try calling apiMethod 3 times, waiting 200 ms between each retry
-async.retry({times: 3, interval: 200}, apiMethod, function(err, result) {
- // do something with the result
-});
-```
-
-```js
-// try calling apiMethod the default 5 times no delay between each retry
-async.retry(apiMethod, function(err, result) {
- // do something with the result
-});
-```
-
-It can also be embedded within other control flow functions to retry individual methods
-that are not as reliable, like this:
-
-```js
-async.auto({
- users: api.getUsers.bind(api),
- payments: async.retry(3, api.getPayments.bind(api))
-}, function(err, results) {
- // do something with the results
-});
-```
-
----------------------------------------
-
-<a name="iterator"></a>
-### iterator(tasks)
-
-Creates an iterator function which calls the next function in the `tasks` array,
-returning a continuation to call the next one after that. It's also possible to
-“peek” at the next iterator with `iterator.next()`.
-
-This function is used internally by the `async` module, but can be useful when
-you want to manually control the flow of functions in series.
-
-__Arguments__
-
-* `tasks` - An array of functions to run.
-
-__Example__
-
-```js
-var iterator = async.iterator([
- function(){ sys.p('one'); },
- function(){ sys.p('two'); },
- function(){ sys.p('three'); }
-]);
-
-node> var iterator2 = iterator();
-'one'
-node> var iterator3 = iterator2();
-'two'
-node> iterator3();
-'three'
-node> var nextfn = iterator2.next();
-node> nextfn();
-'three'
-```
-
-## Utils
-
-<a name="apply"></a>
-### apply(function, arguments..)
-
-Creates a continuation function with some arguments already applied.
-
-Useful as a shorthand when combined with other control flow functions. Any arguments
-passed to the returned function are added to the arguments originally passed
-to apply.
-
-__Arguments__
-
-* `function` - The function you want to eventually apply all arguments to.
-* `arguments...` - Any number of arguments to automatically apply when the
- continuation is called.
-
-__Example__
-
-```js
-// using apply
-
-async.parallel([
- async.apply(fs.writeFile, 'testfile1', 'test1'),
- async.apply(fs.writeFile, 'testfile2', 'test2'),
-]);
-
-
-// the same process without using apply
-
-async.parallel([
- function(callback){
- fs.writeFile('testfile1', 'test1', callback);
- },
- function(callback){
- fs.writeFile('testfile2', 'test2', callback);
- }
-]);
-```
-
-It's possible to pass any number of additional arguments when calling the
-continuation:
-
-```js
-node> var fn = async.apply(sys.puts, 'one');
-node> fn('two', 'three');
-one
-two
-three
-```
-
----------------------------------------
-
-<a name="nextTick"></a>
-### nextTick(callback), setImmediate(callback)
-
-Calls `callback` on a later loop around the event loop. In Node.js this just
-calls `process.nextTick`; in the browser it falls back to `setImmediate(callback)`
-if available, otherwise `setTimeout(callback, 0)`, which means other higher priority
-events may precede the execution of `callback`.
-
-This is used internally for browser-compatibility purposes.
-
-__Arguments__
-
-* `callback` - The function to call on a later loop around the event loop.
-
-__Example__
-
-```js
-var call_order = [];
-async.nextTick(function(){
- call_order.push('two');
- // call_order now equals ['one','two']
-});
-call_order.push('one')
-```
-
----------------------------------------
-
-<a name="times"></a>
-### times(n, iteratee, [callback])
-
-Calls the `iteratee` function `n` times, and accumulates results in the same manner
-you would use with [`map`](#map).
-
-__Arguments__
-
-* `n` - The number of times to run the function.
-* `iteratee` - The function to call `n` times.
-* `callback` - see [`map`](#map)
-
-__Example__
-
-```js
-// Pretend this is some complicated async factory
-var createUser = function(id, callback) {
- callback(null, {
- id: 'user' + id
- })
-}
-// generate 5 users
-async.times(5, function(n, next){
- createUser(n, function(err, user) {
- next(err, user)
- })
-}, function(err, users) {
- // we should now have 5 users
-});
-```
-
-__Related__
-
-* timesSeries(n, iteratee, [callback])
-* timesLimit(n, limit, iteratee, [callback])
-
----------------------------------------
-
-<a name="memoize"></a>
-### memoize(fn, [hasher])
-
-Caches the results of an `async` function. When creating a hash to store function
-results against, the callback is omitted from the hash and an optional hash
-function can be used.
-
-If no hash function is specified, the first argument is used as a hash key, which may work reasonably if it is a string or a data type that converts to a distinct string. Note that objects and arrays will not behave reasonably. Neither will cases where the other arguments are significant. In such cases, specify your own hash function.
-
-The cache of results is exposed as the `memo` property of the function returned
-by `memoize`.
-
-__Arguments__
-
-* `fn` - The function to proxy and cache results from.
-* `hasher` - An optional function for generating a custom hash for storing
- results. It has all the arguments applied to it apart from the callback, and
- must be synchronous.
-
-__Example__
-
-```js
-var slow_fn = function (name, callback) {
- // do something
- callback(null, result);
-};
-var fn = async.memoize(slow_fn);
-
-// fn can now be used as if it were slow_fn
-fn('some name', function () {
- // callback
-});
-```
-
----------------------------------------
-
-<a name="unmemoize"></a>
-### unmemoize(fn)
-
-Undoes a [`memoize`](#memoize)d function, reverting it to the original, unmemoized
-form. Handy for testing.
-
-__Arguments__
-
-* `fn` - the memoized function
-
----------------------------------------
-
-<a name="ensureAsync"></a>
-### ensureAsync(fn)
-
-Wrap an async function and ensure it calls its callback on a later tick of the event loop. If the function already calls its callback on a next tick, no extra deferral is added. This is useful for preventing stack overflows (`RangeError: Maximum call stack size exceeded`) and generally keeping [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony) contained.
-
-__Arguments__
-
-* `fn` - an async function, one that expects a node-style callback as its last argument
-
-Returns a wrapped function with the exact same call signature as the function passed in.
-
-__Example__
-
-```js
-function sometimesAsync(arg, callback) {
- if (cache[arg]) {
- return callback(null, cache[arg]); // this would be synchronous!!
- } else {
- doSomeIO(arg, callback); // this IO would be asynchronous
- }
-}
-
-// this has a risk of stack overflows if many results are cached in a row
-async.mapSeries(args, sometimesAsync, done);
-
-// this will defer sometimesAsync's callback if necessary,
-// preventing stack overflows
-async.mapSeries(args, async.ensureAsync(sometimesAsync), done);
-
-```
-
----------------------------------------
-
-<a name="constant"></a>
-### constant(values...)
-
-Returns a function that when called, calls-back with the values provided. Useful as the first function in a `waterfall`, or for plugging values in to `auto`.
-
-__Example__
-
-```js
-async.waterfall([
- async.constant(42),
- function (value, next) {
- // value === 42
- },
- //...
-], callback);
-
-async.waterfall([
- async.constant(filename, "utf8"),
- fs.readFile,
- function (fileData, next) {
- //...
- }
- //...
-], callback);
-
-async.auto({
- hostname: async.constant("https://server.net/"),
- port: findFreePort,
- launchServer: ["hostname", "port", function (cb, options) {
- startServer(options, cb);
- }],
- //...
-}, callback);
-
-```
-
----------------------------------------
-
-<a name="asyncify"></a>
-<a name="wrapSync"></a>
-### asyncify(func)
-
-__Alias:__ `wrapSync`
-
-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, series, or other async functions. Any arguments passed to the generated function will be passed to the wrapped function (except for the final callback argument). Errors thrown will be passed to the callback.
-
-__Example__
-
-```js
-async.waterfall([
- async.apply(fs.readFile, filename, "utf8"),
- async.asyncify(JSON.parse),
- function (data, next) {
- // data is the result of parsing the text.
- // If there was a parsing error, it would have been caught.
- }
-], callback)
-```
-
-If the function passed to `asyncify` returns a Promise, that promises's resolved/rejected state will be used to call the callback, rather than simply the synchronous return value. Example:
-
-```js
-async.waterfall([
- async.apply(fs.readFile, filename, "utf8"),
- async.asyncify(function (contents) {
- return db.model.create(contents);
- }),
- function (model, next) {
- // `model` is the instantiated model object.
- // If there was an error, this function would be skipped.
- }
-], callback)
-```
-
-This also means you can asyncify ES2016 `async` functions.
-
-```js
-var q = async.queue(async.asyncify(async function (file) {
- var intermediateStep = await processFile(file);
- return await somePromise(intermediateStep)
-}));
-
-q.push(files);
-```
-
----------------------------------------
-
-<a name="log"></a>
-### log(function, arguments)
-
-Logs the result of an `async` function to the `console`. Only works in Node.js or
-in browsers that support `console.log` and `console.error` (such as FF and Chrome).
-If multiple arguments are returned from the async function, `console.log` is
-called on each argument in order.
-
-__Arguments__
-
-* `function` - The function you want to eventually apply all arguments to.
-* `arguments...` - Any number of arguments to apply to the function.
-
-__Example__
-
-```js
-var hello = function(name, callback){
- setTimeout(function(){
- callback(null, 'hello ' + name);
- }, 1000);
-};
-```
-```js
-node> async.log(hello, 'world');
-'hello world'
-```
-
----------------------------------------
-
-<a name="dir"></a>
-### dir(function, arguments)
-
-Logs the result of an `async` function to the `console` using `console.dir` to
-display the properties of the resulting object. Only works in Node.js or
-in browsers that support `console.dir` and `console.error` (such as FF and Chrome).
-If multiple arguments are returned from the async function, `console.dir` is
-called on each argument in order.
-
-__Arguments__
-
-* `function` - The function you want to eventually apply all arguments to.
-* `arguments...` - Any number of arguments to apply to the function.
-
-__Example__
-
-```js
-var hello = function(name, callback){
- setTimeout(function(){
- callback(null, {hello: name});
- }, 1000);
-};
-```
-```js
-node> async.dir(hello, 'world');
-{hello: 'world'}
-```
-
----------------------------------------
-
-<a name="noConflict"></a>
-### noConflict()
-
-Changes the value of `async` back to its original value, returning a reference to the
-`async` object.
diff --git a/build/apply.js b/build/apply.js
deleted file mode 100644
index 17ebec2..0000000
--- a/build/apply.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _rest = require('lodash/rest');
-
-var _rest2 = _interopRequireDefault(_rest);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-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/build/applyEach.js b/build/applyEach.js
deleted file mode 100644
index 39da0c7..0000000
--- a/build/applyEach.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _applyEach = require('./internal/applyEach');
-
-var _applyEach2 = _interopRequireDefault(_applyEach);
-
-var _eachOf = require('./eachOf');
-
-var _eachOf2 = _interopRequireDefault(_eachOf);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _applyEach2.default)(_eachOf2.default);
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/applyEachSeries.js b/build/applyEachSeries.js
deleted file mode 100644
index cdffc2c..0000000
--- a/build/applyEachSeries.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _applyEach = require('./internal/applyEach');
-
-var _applyEach2 = _interopRequireDefault(_applyEach);
-
-var _eachOfSeries = require('./eachOfSeries');
-
-var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _applyEach2.default)(_eachOfSeries2.default);
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/asyncify.js b/build/asyncify.js
deleted file mode 100644
index 6fa1ca0..0000000
--- a/build/asyncify.js
+++ /dev/null
@@ -1,39 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = asyncify;
-
-var _isObject = require('lodash/isObject');
-
-var _isObject2 = _interopRequireDefault(_isObject);
-
-var _rest = require('lodash/rest');
-
-var _rest2 = _interopRequireDefault(_rest);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function asyncify(func) {
- return (0, _rest2.default)(function (args) {
- var callback = args.pop();
- var result;
- try {
- result = func.apply(this, args);
- } catch (e) {
- return callback(e);
- }
- // if result is Promise object
- if ((0, _isObject2.default)(result) && typeof result.then === 'function') {
- result.then(function (value) {
- callback(null, value);
- })['catch'](function (err) {
- callback(err.message ? err : new Error(err));
- });
- } else {
- callback(null, result);
- }
- });
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/auto.js b/build/auto.js
deleted file mode 100644
index 26046a7..0000000
--- a/build/auto.js
+++ /dev/null
@@ -1,149 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-exports.default = function (tasks, concurrency, callback) {
- if (typeof arguments[1] === 'function') {
- // concurrency is optional, shift the args.
- callback = concurrency;
- concurrency = null;
- }
- callback = (0, _once2.default)(callback || _noop2.default);
- var keys = (0, _keys2.default)(tasks);
- var remainingTasks = keys.length;
- if (!remainingTasks) {
- return callback(null);
- }
- if (!concurrency) {
- concurrency = remainingTasks;
- }
-
- var results = {};
- var runningTasks = 0;
- var hasError = false;
-
- var listeners = [];
- function addListener(fn) {
- listeners.unshift(fn);
- }
- function removeListener(fn) {
- var idx = (0, _indexOf2.default)(listeners, fn);
- if (idx >= 0) listeners.splice(idx, 1);
- }
- function taskComplete() {
- remainingTasks--;
- (0, _arrayEach2.default)(listeners.slice(), function (fn) {
- fn();
- });
- }
-
- addListener(function () {
- if (!remainingTasks) {
- callback(null, results);
- }
- });
-
- (0, _arrayEach2.default)(keys, function (k) {
- if (hasError) return;
- var task = (0, _isArray2.default)(tasks[k]) ? tasks[k] : [tasks[k]];
- var taskCallback = (0, _rest2.default)(function (err, args) {
- runningTasks--;
- if (args.length <= 1) {
- args = args[0];
- }
- if (err) {
- var safeResults = {};
- (0, _forOwn2.default)(results, function (val, rkey) {
- safeResults[rkey] = val;
- });
- safeResults[k] = args;
- hasError = true;
-
- callback(err, safeResults);
- } else {
- results[k] = args;
- (0, _setImmediate2.default)(taskComplete);
- }
- });
- var requires = task.slice(0, task.length - 1);
- // prevent dead-locks
- var len = requires.length;
- var dep;
- while (len--) {
- if (!(dep = tasks[requires[len]])) {
- throw new Error('Has non-existent dependency in ' + requires.join(', '));
- }
- if ((0, _isArray2.default)(dep) && (0, _indexOf2.default)(dep, k) >= 0) {
- throw new Error('Has cyclic dependencies');
- }
- }
- function ready() {
- return runningTasks < concurrency && !(0, _baseHas2.default)(results, k) && (0, _arrayEvery2.default)(requires, function (x) {
- return (0, _baseHas2.default)(results, x);
- });
- }
- if (ready()) {
- runningTasks++;
- task[task.length - 1](taskCallback, results);
- } else {
- addListener(listener);
- }
- function listener() {
- if (ready()) {
- runningTasks++;
- removeListener(listener);
- task[task.length - 1](taskCallback, results);
- }
- }
- });
-};
-
-var _arrayEach = require('lodash/_arrayEach');
-
-var _arrayEach2 = _interopRequireDefault(_arrayEach);
-
-var _arrayEvery = require('lodash/_arrayEvery');
-
-var _arrayEvery2 = _interopRequireDefault(_arrayEvery);
-
-var _baseHas = require('lodash/_baseHas');
-
-var _baseHas2 = _interopRequireDefault(_baseHas);
-
-var _forOwn = require('lodash/forOwn');
-
-var _forOwn2 = _interopRequireDefault(_forOwn);
-
-var _indexOf = require('lodash/indexOf');
-
-var _indexOf2 = _interopRequireDefault(_indexOf);
-
-var _isArray = require('lodash/isArray');
-
-var _isArray2 = _interopRequireDefault(_isArray);
-
-var _keys = require('lodash/keys');
-
-var _keys2 = _interopRequireDefault(_keys);
-
-var _noop = require('lodash/noop');
-
-var _noop2 = _interopRequireDefault(_noop);
-
-var _once = require('lodash/once');
-
-var _once2 = _interopRequireDefault(_once);
-
-var _rest = require('lodash/rest');
-
-var _rest2 = _interopRequireDefault(_rest);
-
-var _setImmediate = require('./internal/setImmediate');
-
-var _setImmediate2 = _interopRequireDefault(_setImmediate);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/bower.json b/build/bower.json
deleted file mode 100644
index c708594..0000000
--- a/build/bower.json
+++ /dev/null
@@ -1,67 +0,0 @@
-{
- "name": "async",
- "description": "Higher-order functions and common patterns for asynchronous code",
- "main": "dist/async.js",
- "keywords": [
- "async",
- "callback",
- "module",
- "utility"
- ],
- "license": "MIT",
- "repository": {
- "type": "git",
- "url": "https://github.com/caolan/async.git"
- },
- "devDependencies": {
- "babel-cli": "^6.3.17",
- "babel-core": "^6.3.26",
- "babel-plugin-add-module-exports": "~0.1.2",
- "babel-plugin-transform-es2015-modules-commonjs": "^6.3.16",
- "babel-preset-es2015": "^6.3.13",
- "babelify": "^7.2.0",
- "benchmark": "bestiejs/benchmark.js",
- "bluebird": "^2.9.32",
- "chai": "^3.1.0",
- "coveralls": "^2.11.2",
- "es6-promise": "^2.3.0",
- "fs-extra": "^0.26.3",
- "gulp": "~3.9.0",
- "jscs": "^1.13.1",
- "jshint": "~2.8.0",
- "karma": "^0.13.2",
- "karma-browserify": "^4.2.1",
- "karma-firefox-launcher": "^0.1.6",
- "karma-mocha": "^0.2.0",
- "karma-mocha-reporter": "^1.0.2",
- "mocha": "^2.2.5",
- "native-promise-only": "^0.8.0-a",
- "nodeunit": ">0.0.0",
- "nyc": "^2.1.0",
- "recursive-readdir": "^1.3.0",
- "rimraf": "^2.5.0",
- "rollup": "^0.25.0",
- "rollup-plugin-npm": "~1.3.0",
- "rsvp": "^3.0.18",
- "semver": "^4.3.6",
- "uglify-js": "~2.4.0",
- "vinyl-buffer": "~1.0.0",
- "vinyl-source-stream": "~1.1.0",
- "yargs": "~3.9.1"
- },
- "moduleType": [
- "amd",
- "globals",
- "node"
- ],
- "ignore": [
- "**/.*",
- "node_modules",
- "bower_components",
- "test",
- "tests"
- ],
- "authors": [
- "Caolan McMahon"
- ]
-} \ No newline at end of file
diff --git a/build/cargo.js b/build/cargo.js
deleted file mode 100644
index 44b08ec..0000000
--- a/build/cargo.js
+++ /dev/null
@@ -1,17 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = cargo;
-
-var _queue = require('./internal/queue');
-
-var _queue2 = _interopRequireDefault(_queue);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function cargo(worker, payload) {
- return (0, _queue2.default)(worker, 1, payload);
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/component.json b/build/component.json
deleted file mode 100644
index 2ce99fc..0000000
--- a/build/component.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "name": "async",
- "description": "Higher-order functions and common patterns for asynchronous code",
- "version": "2.0.0-alpha",
- "keywords": [
- "async",
- "callback",
- "module",
- "utility"
- ],
- "license": "MIT",
- "main": "dist/async.js",
- "repository": "caolan/async",
- "scripts": [
- "dist/async.js"
- ]
-} \ No newline at end of file
diff --git a/build/compose.js b/build/compose.js
deleted file mode 100644
index 665f55d..0000000
--- a/build/compose.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = compose;
-
-var _seq = require('./seq');
-
-var _seq2 = _interopRequireDefault(_seq);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-var reverse = Array.prototype.reverse;
-
-function compose() /* functions... */{
- return _seq2.default.apply(null, reverse.call(arguments));
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/concat.js b/build/concat.js
deleted file mode 100644
index 952078a..0000000
--- a/build/concat.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _concat = require('./internal/concat');
-
-var _concat2 = _interopRequireDefault(_concat);
-
-var _doParallel = require('./internal/doParallel');
-
-var _doParallel2 = _interopRequireDefault(_doParallel);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _doParallel2.default)(_concat2.default);
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/concatSeries.js b/build/concatSeries.js
deleted file mode 100644
index dc5b167..0000000
--- a/build/concatSeries.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _concat = require('./internal/concat');
-
-var _concat2 = _interopRequireDefault(_concat);
-
-var _doSeries = require('./internal/doSeries');
-
-var _doSeries2 = _interopRequireDefault(_doSeries);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _doSeries2.default)(_concat2.default);
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/constant.js b/build/constant.js
deleted file mode 100644
index 757cd6f..0000000
--- a/build/constant.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _rest = require('lodash/rest');
-
-var _rest2 = _interopRequireDefault(_rest);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _rest2.default)(function (values) {
- var args = [null].concat(values);
- return function (cb) {
- return cb.apply(this, args);
- };
-});
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/detect.js b/build/detect.js
deleted file mode 100644
index ea3fc69..0000000
--- a/build/detect.js
+++ /dev/null
@@ -1,26 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _identity = require('lodash/identity');
-
-var _identity2 = _interopRequireDefault(_identity);
-
-var _createTester = require('./internal/createTester');
-
-var _createTester2 = _interopRequireDefault(_createTester);
-
-var _eachOf = require('./eachOf');
-
-var _eachOf2 = _interopRequireDefault(_eachOf);
-
-var _findGetResult = require('./internal/findGetResult');
-
-var _findGetResult2 = _interopRequireDefault(_findGetResult);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _createTester2.default)(_eachOf2.default, _identity2.default, _findGetResult2.default);
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/detectLimit.js b/build/detectLimit.js
deleted file mode 100644
index 105c569..0000000
--- a/build/detectLimit.js
+++ /dev/null
@@ -1,26 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _identity = require('lodash/identity');
-
-var _identity2 = _interopRequireDefault(_identity);
-
-var _createTester = require('./internal/createTester');
-
-var _createTester2 = _interopRequireDefault(_createTester);
-
-var _eachOfLimit = require('./eachOfLimit');
-
-var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
-
-var _findGetResult = require('./internal/findGetResult');
-
-var _findGetResult2 = _interopRequireDefault(_findGetResult);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _createTester2.default)(_eachOfLimit2.default, _identity2.default, _findGetResult2.default);
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/detectSeries.js b/build/detectSeries.js
deleted file mode 100644
index 42b6890..0000000
--- a/build/detectSeries.js
+++ /dev/null
@@ -1,26 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _identity = require('lodash/identity');
-
-var _identity2 = _interopRequireDefault(_identity);
-
-var _createTester = require('./internal/createTester');
-
-var _createTester2 = _interopRequireDefault(_createTester);
-
-var _eachOfSeries = require('./eachOfSeries');
-
-var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
-
-var _findGetResult = require('./internal/findGetResult');
-
-var _findGetResult2 = _interopRequireDefault(_findGetResult);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _createTester2.default)(_eachOfSeries2.default, _identity2.default, _findGetResult2.default);
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/dir.js b/build/dir.js
deleted file mode 100644
index 8641134..0000000
--- a/build/dir.js
+++ /dev/null
@@ -1,14 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _consoleFunc = require('./internal/consoleFunc');
-
-var _consoleFunc2 = _interopRequireDefault(_consoleFunc);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _consoleFunc2.default)('dir');
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/dist/async.js b/build/dist/async.js
deleted file mode 100644
index 0032ce5..0000000
--- a/build/dist/async.js
+++ /dev/null
@@ -1,2563 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
- (factory((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 {...*} args The arguments to invoke `func` with.
- * @returns {*} Returns the result of `func`.
- */
- function apply$1(func, thisArg, args) {
- var length = args.length;
- switch (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);
- }
-
- /**
- * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
- * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
- * @example
- *
- * _.isObject({});
- * // => true
- *
- * _.isObject([1, 2, 3]);
- * // => true
- *
- * _.isObject(_.noop);
- * // => true
- *
- * _.isObject(null);
- * // => false
- */
- function isObject(value) {
- var type = typeof value;
- return !!value && (type == 'object' || type == 'function');
- }
-
- var funcTag = '[object Function]';
- var genTag = '[object GeneratorFunction]';
- /** Used for built-in method references. */
- var objectProto$4 = Object.prototype;
-
- /**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objectToString$2 = objectProto$4.toString;
-
- /**
- * Checks if `value` is classified as a `Function` object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isFunction(_);
- * // => true
- *
- * _.isFunction(/abc/);
- * // => false
- */
- function isFunction(value) {
- // The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 8 which returns 'object' for typed array constructors, and
- // PhantomJS 1.9 which returns 'function' for `NodeList` instances.
- var tag = isObject(value) ? objectToString$2.call(value) : '';
- return tag == funcTag || tag == genTag;
- }
-
- /** Used as references for various `Number` constants. */
- var NAN = 0 / 0;
-
- /** Used to match leading and trailing whitespace. */
- var reTrim = /^\s+|\s+$/g;
-
- /** Used to detect bad signed hexadecimal string values. */
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
-
- /** Used to detect binary string values. */
- var reIsBinary = /^0b[01]+$/i;
-
- /** Used to detect octal string values. */
- var reIsOctal = /^0o[0-7]+$/i;
-
- /** Built-in method references without a dependency on `root`. */
- var freeParseInt = parseInt;
-
- /**
- * Converts `value` to a number.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to process.
- * @returns {number} Returns the number.
- * @example
- *
- * _.toNumber(3);
- * // => 3
- *
- * _.toNumber(Number.MIN_VALUE);
- * // => 5e-324
- *
- * _.toNumber(Infinity);
- * // => Infinity
- *
- * _.toNumber('3');
- * // => 3
- */
- function toNumber(value) {
- if (isObject(value)) {
- var other = isFunction(value.valueOf) ? value.valueOf() : value;
- value = isObject(other) ? (other + '') : other;
- }
- if (typeof value != 'string') {
- return value === 0 ? value : +value;
- }
- value = value.replace(reTrim, '');
- var isBinary = reIsBinary.test(value);
- return (isBinary || reIsOctal.test(value))
- ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
- : (reIsBadHex.test(value) ? NAN : +value);
- }
-
- var INFINITY = 1 / 0;
- var MAX_INTEGER = 1.7976931348623157e+308;
- /**
- * Converts `value` to an integer.
- *
- * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to convert.
- * @returns {number} Returns the converted integer.
- * @example
- *
- * _.toInteger(3);
- * // => 3
- *
- * _.toInteger(Number.MIN_VALUE);
- * // => 0
- *
- * _.toInteger(Infinity);
- * // => 1.7976931348623157e+308
- *
- * _.toInteger('3');
- * // => 3
- */
- function toInteger(value) {
- if (!value) {
- return value === 0 ? value : 0;
- }
- value = toNumber(value);
- if (value === INFINITY || value === -INFINITY) {
- var sign = (value < 0 ? -1 : 1);
- return sign * MAX_INTEGER;
- }
- var remainder = value % 1;
- return value === value ? (remainder ? value - remainder : value) : 0;
- }
-
- /** Used as the `TypeError` message for "Functions" methods. */
- var FUNC_ERROR_TEXT = 'Expected a function';
-
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeMax = Math.max;
-
- /**
- * Creates a function that invokes `func` with the `this` binding of the
- * created function and arguments from `start` and beyond provided as an array.
- *
- * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters).
- *
- * @static
- * @memberOf _
- * @category Function
- * @param {Function} func The function to apply a rest parameter to.
- * @param {number} [start=func.length-1] The start position of the rest parameter.
- * @returns {Function} Returns the new function.
- * @example
- *
- * var say = _.rest(function(what, names) {
- * return what + ' ' + _.initial(names).join(', ') +
- * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
- * });
- *
- * say('hello', 'fred', 'barney', 'pebbles');
- * // => 'hello fred, barney, & pebbles'
- */
- function rest(func, start) {
- if (typeof func != 'function') {
- throw new TypeError(FUNC_ERROR_TEXT);
- }
- start = nativeMax(start === undefined ? (func.length - 1) : toInteger(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];
- }
- switch (start) {
- case 0: return func.call(this, array);
- case 1: return func.call(this, args[0], array);
- case 2: return func.call(this, args[0], args[1], array);
- }
- var otherArgs = Array(start + 1);
- index = -1;
- while (++index < start) {
- otherArgs[index] = args[index];
- }
- otherArgs[start] = array;
- return apply$1(func, this, otherArgs);
- };
- }
-
- function applyEach$1(eachfn) {
- return rest(function (fns, args) {
- var go = rest(function (args) {
- var that = this;
- var callback = args.pop();
- return eachfn(fns, function (fn, _, cb) {
- fn.apply(that, args.concat([cb]));
- }, callback);
- });
- if (args.length) {
- return go.apply(this, args);
- } else {
- return go;
- }
- });
- }
-
- /** Used as the `TypeError` message for "Functions" methods. */
- var FUNC_ERROR_TEXT$1 = 'Expected a function';
-
- /**
- * Creates a function that invokes `func`, with the `this` binding and arguments
- * of the created function, while it's called less than `n` times. Subsequent
- * calls to the created function return the result of the last `func` invocation.
- *
- * @static
- * @memberOf _
- * @category Function
- * @param {number} n The number of calls at which `func` is no longer invoked.
- * @param {Function} func The function to restrict.
- * @returns {Function} Returns the new restricted function.
- * @example
- *
- * jQuery(element).on('click', _.before(5, addContactToList));
- * // => allows adding up to 4 contacts to the list
- */
- function before(n, func) {
- var result;
- if (typeof func != 'function') {
- throw new TypeError(FUNC_ERROR_TEXT$1);
- }
- n = toInteger(n);
- return function() {
- if (--n > 0) {
- result = func.apply(this, arguments);
- }
- if (n <= 1) {
- func = undefined;
- }
- return result;
- };
- }
-
- /**
- * Creates a function that is restricted to invoking `func` once. Repeat calls
- * to the function return the value of the first invocation. The `func` is
- * invoked with the `this` binding and arguments of the created function.
- *
- * @static
- * @memberOf _
- * @category Function
- * @param {Function} func The function to restrict.
- * @returns {Function} Returns the new restricted function.
- * @example
- *
- * var initialize = _.once(createApplication);
- * initialize();
- * initialize();
- * // `initialize` invokes `createApplication` once
- */
- function once(func) {
- return before(2, func);
- }
-
- /**
- * A no-operation function that returns `undefined` regardless of the
- * arguments it receives.
- *
- * @static
- * @memberOf _
- * @category Util
- * @example
- *
- * var object = { 'user': 'fred' };
- *
- * _.noop(object) === undefined;
- * // => true
- */
- function noop() {
- // No operation performed.
- }
-
- /**
- * The base implementation of `_.property` without support for deep paths.
- *
- * @private
- * @param {string} key The key of the property to get.
- * @returns {Function} Returns the new function.
- */
- function baseProperty(key) {
- return function(object) {
- return object == null ? undefined : object[key];
- };
- }
-
- /**
- * Gets the "length" property value of `object`.
- *
- * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
- * that affects Safari on at least iOS 8.1-8.3 ARM64.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {*} Returns the "length" value.
- */
- var getLength = baseProperty('length');
-
- /** Used as references for various `Number` constants. */
- var MAX_SAFE_INTEGER$1 = 9007199254740991;
-
- /**
- * Checks if `value` is a valid array-like length.
- *
- * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
- * @example
- *
- * _.isLength(3);
- * // => true
- *
- * _.isLength(Number.MIN_VALUE);
- * // => false
- *
- * _.isLength(Infinity);
- * // => false
- *
- * _.isLength('3');
- * // => false
- */
- function isLength(value) {
- return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
- }
-
- /**
- * Checks if `value` is array-like. A value is considered array-like if it's
- * not a function and has a `value.length` that's an integer greater than or
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
- *
- * @static
- * @memberOf _
- * @type Function
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
- * @example
- *
- * _.isArrayLike([1, 2, 3]);
- * // => true
- *
- * _.isArrayLike(document.body.children);
- * // => true
- *
- * _.isArrayLike('abc');
- * // => true
- *
- * _.isArrayLike(_.noop);
- * // => false
- */
- function isArrayLike(value) {
- return value != null &&
- !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));
- }
-
- /** Used for built-in method references. */
- var objectProto = Object.prototype;
-
- /** Used to check objects for own properties. */
- var hasOwnProperty = objectProto.hasOwnProperty;
-
- /** Built-in value references. */
- var getPrototypeOf = Object.getPrototypeOf;
-
- /**
- * The base implementation of `_.has` without support for deep paths.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array|string} key The key to check.
- * @returns {boolean} Returns `true` if `key` exists, else `false`.
- */
- function baseHas(object, key) {
- // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,
- // that are composed entirely of index properties, return `false` for
- // `hasOwnProperty` checks of them.
- return hasOwnProperty.call(object, key) ||
- (typeof object == 'object' && key in object && getPrototypeOf(object) === null);
- }
-
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeKeys = Object.keys;
-
- /**
- * The base implementation of `_.keys` which doesn't skip the constructor
- * property of prototypes or treat sparse arrays as dense.
- *
- * @private
- * @type Function
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- */
- function baseKeys(object) {
- return nativeKeys(Object(object));
- }
-
- /**
- * The base implementation of `_.times` without support for iteratee shorthands
- * or max array length checks.
- *
- * @private
- * @param {number} n The number of times to invoke `iteratee`.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the array of results.
- */
- function baseTimes(n, iteratee) {
- var index = -1,
- result = Array(n);
-
- while (++index < n) {
- result[index] = iteratee(index);
- }
- return result;
- }
-
- /**
- * Checks if `value` is object-like. A value is object-like if it's not `null`
- * and has a `typeof` result of "object".
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
- * @example
- *
- * _.isObjectLike({});
- * // => true
- *
- * _.isObjectLike([1, 2, 3]);
- * // => true
- *
- * _.isObjectLike(_.noop);
- * // => false
- *
- * _.isObjectLike(null);
- * // => false
- */
- function isObjectLike(value) {
- return !!value && typeof value == 'object';
- }
-
- /**
- * This method is like `_.isArrayLike` except that it also checks if `value`
- * is an object.
- *
- * @static
- * @memberOf _
- * @type Function
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.
- * @example
- *
- * _.isArrayLikeObject([1, 2, 3]);
- * // => true
- *
- * _.isArrayLikeObject(document.body.children);
- * // => true
- *
- * _.isArrayLikeObject('abc');
- * // => false
- *
- * _.isArrayLikeObject(_.noop);
- * // => false
- */
- function isArrayLikeObject(value) {
- return isObjectLike(value) && isArrayLike(value);
- }
-
- /** `Object#toString` result references. */
- var argsTag = '[object Arguments]';
-
- /** Used for built-in method references. */
- var objectProto$2 = Object.prototype;
-
- /** Used to check objects for own properties. */
- var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
-
- /**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objectToString = objectProto$2.toString;
-
- /** Built-in value references. */
- var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
-
- /**
- * Checks if `value` is likely an `arguments` object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isArguments(function() { return arguments; }());
- * // => true
- *
- * _.isArguments([1, 2, 3]);
- * // => false
- */
- function isArguments(value) {
- // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.
- return isArrayLikeObject(value) && hasOwnProperty$1.call(value, 'callee') &&
- (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
- }
-
- /**
- * Checks if `value` is classified as an `Array` object.
- *
- * @static
- * @memberOf _
- * @type Function
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isArray([1, 2, 3]);
- * // => true
- *
- * _.isArray(document.body.children);
- * // => false
- *
- * _.isArray('abc');
- * // => false
- *
- * _.isArray(_.noop);
- * // => false
- */
- var isArray = Array.isArray;
-
- /** `Object#toString` result references. */
- var stringTag = '[object String]';
-
- /** Used for built-in method references. */
- var objectProto$3 = Object.prototype;
-
- /**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objectToString$1 = objectProto$3.toString;
-
- /**
- * Checks if `value` is classified as a `String` primitive or object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isString('abc');
- * // => true
- *
- * _.isString(1);
- * // => false
- */
- function isString(value) {
- return typeof value == 'string' ||
- (!isArray(value) && isObjectLike(value) && objectToString$1.call(value) == stringTag);
- }
-
- /**
- * Creates an array of index keys for `object` values of arrays,
- * `arguments` objects, and strings, otherwise `null` is returned.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {Array|null} Returns index keys, else `null`.
- */
- function indexKeys(object) {
- var length = object ? object.length : undefined;
- if (isLength(length) &&
- (isArray(object) || isString(object) || isArguments(object))) {
- return baseTimes(length, String);
- }
- return null;
- }
-
- /** Used as references for various `Number` constants. */
- var MAX_SAFE_INTEGER = 9007199254740991;
-
- /** Used to detect unsigned integer values. */
- var reIsUint = /^(?:0|[1-9]\d*)$/;
-
- /**
- * Checks if `value` is a valid array-like index.
- *
- * @private
- * @param {*} value The value to check.
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
- */
- function isIndex(value, length) {
- value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
- length = length == null ? MAX_SAFE_INTEGER : length;
- return value > -1 && value % 1 == 0 && value < length;
- }
-
- /** Used for built-in method references. */
- var objectProto$1 = Object.prototype;
-
- /**
- * Checks if `value` is likely a prototype object.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
- */
- function isPrototype(value) {
- var Ctor = value && value.constructor,
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$1;
-
- return value === proto;
- }
-
- /**
- * Creates an array of the own enumerable property names of `object`.
- *
- * **Note:** Non-object values are coerced to objects. See the
- * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
- * for more details.
- *
- * @static
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @returns {Array} Returns the array of property names.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.keys(new Foo);
- * // => ['a', 'b'] (iteration order is not guaranteed)
- *
- * _.keys('hi');
- * // => ['0', '1']
- */
- function keys(object) {
- var isProto = isPrototype(object);
- if (!(isProto || isArrayLike(object))) {
- return baseKeys(object);
- }
- var indexes = indexKeys(object),
- skipIndexes = !!indexes,
- result = indexes || [],
- length = result.length;
-
- for (var key in object) {
- if (baseHas(object, key) &&
- !(skipIndexes && (key == 'length' || isIndex(key, length))) &&
- !(isProto && key == 'constructor')) {
- result.push(key);
- }
- }
- return result;
- }
-
- function keyIterator(coll) {
- var i = -1;
- var len;
- if (isArrayLike(coll)) {
- len = coll.length;
- return function next() {
- i++;
- return i < len ? i : null;
- };
- } else {
- var okeys = keys(coll);
- len = okeys.length;
- return function next() {
- i++;
- return i < len ? okeys[i] : null;
- };
- }
- }
-
- function onlyOnce(fn) {
- return function () {
- if (fn === null) throw new Error("Callback was already called.");
- fn.apply(this, arguments);
- fn = null;
- };
- }
-
- function eachOf(object, iterator, callback) {
- callback = once(callback || noop);
- object = object || [];
-
- var iter = keyIterator(object);
- var key,
- completed = 0;
-
- while ((key = iter()) != null) {
- completed += 1;
- iterator(object[key], key, onlyOnce(done));
- }
-
- if (completed === 0) callback(null);
-
- function done(err) {
- completed--;
- if (err) {
- callback(err);
- }
- // Check key is null in case iterator isn't exhausted
- // and done resolved synchronously.
- else if (key === null && completed <= 0) {
- callback(null);
- }
- }
- }
-
- var applyEach = applyEach$1(eachOf);
-
- var _setImmediate = typeof setImmediate === 'function' && setImmediate;
-
- var _delay;
- if (_setImmediate) {
- _delay = function (fn) {
- // not a direct alias for IE10 compatibility
- _setImmediate(fn);
- };
- } else if (typeof process === 'object' && typeof process.nextTick === 'function') {
- _delay = process.nextTick;
- } else {
- _delay = function (fn) {
- setTimeout(fn, 0);
- };
- }
-
- var setImmediate$1 = _delay;
-
- function eachOfSeries(obj, iterator, callback) {
- callback = once(callback || noop);
- obj = obj || [];
- var nextKey = keyIterator(obj);
- var key = nextKey();
-
- function iterate() {
- var sync = true;
- if (key === null) {
- return callback(null);
- }
- iterator(obj[key], key, onlyOnce(function (err) {
- if (err) {
- callback(err);
- } else {
- key = nextKey();
- if (key === null) {
- return callback(null);
- } else {
- if (sync) {
- setImmediate$1(iterate);
- } else {
- iterate();
- }
- }
- }
- }));
- sync = false;
- }
- iterate();
- }
-
- var applyEachSeries = applyEach$1(eachOfSeries);
-
- var apply = rest(function (fn, args) {
- return rest(function (callArgs) {
- return fn.apply(null, args.concat(callArgs));
- });
- });
-
- function asyncify(func) {
- return rest(function (args) {
- var callback = args.pop();
- var result;
- try {
- result = func.apply(this, args);
- } catch (e) {
- return callback(e);
- }
- // if result is Promise object
- if (isObject(result) && typeof result.then === 'function') {
- result.then(function (value) {
- callback(null, value);
- })['catch'](function (err) {
- callback(err.message ? err : new Error(err));
- });
- } else {
- callback(null, result);
- }
- });
- }
-
- /**
- * A specialized version of `_.forEach` for arrays without support for
- * iteratee shorthands.
- *
- * @private
- * @param {Array} array The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns `array`.
- */
- function arrayEach(array, iteratee) {
- var index = -1,
- length = array.length;
-
- while (++index < length) {
- if (iteratee(array[index], index, array) === false) {
- break;
- }
- }
- return array;
- }
-
- /**
- * A specialized version of `_.every` for arrays without support for
- * iteratee shorthands.
- *
- * @private
- * @param {Array} array The array to iterate over.
- * @param {Function} predicate The function invoked per iteration.
- * @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`.
- */
- function arrayEvery(array, predicate) {
- var index = -1,
- length = array.length;
-
- while (++index < length) {
- if (!predicate(array[index], index, array)) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Creates a base function for methods like `_.forIn`.
- *
- * @private
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Function} Returns the new base function.
- */
- function createBaseFor(fromRight) {
- return function(object, iteratee, keysFunc) {
- var index = -1,
- iterable = Object(object),
- props = keysFunc(object),
- length = props.length;
-
- while (length--) {
- var key = props[fromRight ? length : ++index];
- if (iteratee(iterable[key], key, iterable) === false) {
- break;
- }
- }
- return object;
- };
- }
-
- /**
- * The base implementation of `baseForIn` and `baseForOwn` which iterates
- * over `object` properties returned by `keysFunc` invoking `iteratee` for
- * each property. Iteratee functions may exit iteration early by explicitly
- * returning `false`.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @param {Function} keysFunc The function to get the keys of `object`.
- * @returns {Object} Returns `object`.
- */
- var baseFor = createBaseFor();
-
- /**
- * The base implementation of `_.forOwn` without support for iteratee shorthands.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Object} Returns `object`.
- */
- function baseForOwn(object, iteratee) {
- return object && baseFor(object, iteratee, keys);
- }
-
- /**
- * This method returns the first argument given to it.
- *
- * @static
- * @memberOf _
- * @category Util
- * @param {*} value Any value.
- * @returns {*} Returns `value`.
- * @example
- *
- * var object = { 'user': 'fred' };
- *
- * _.identity(object) === object;
- * // => true
- */
- function identity(value) {
- return value;
- }
-
- /**
- * Converts `value` to a function if it's not one.
- *
- * @private
- * @param {*} value The value to process.
- * @returns {Function} Returns the function.
- */
- function toFunction(value) {
- return typeof value == 'function' ? value : identity;
- }
-
- /**
- * Iterates over own enumerable properties of an object invoking `iteratee`
- * for each property. The iteratee is invoked with three arguments:
- * (value, key, object). Iteratee functions may exit iteration early by
- * explicitly returning `false`.
- *
- * @static
- * @memberOf _
- * @category Object
- * @param {Object} object The object to iterate over.
- * @param {Function} [iteratee=_.identity] The function invoked per iteration.
- * @returns {Object} Returns `object`.
- * @example
- *
- * function Foo() {
- * this.a = 1;
- * this.b = 2;
- * }
- *
- * Foo.prototype.c = 3;
- *
- * _.forOwn(new Foo, function(value, key) {
- * console.log(key);
- * });
- * // => logs 'a' then 'b' (iteration order is not guaranteed)
- */
- function forOwn(object, iteratee) {
- return object && baseForOwn(object, toFunction(iteratee));
- }
-
- /**
- * Gets the index at which the first occurrence of `NaN` is found in `array`.
- *
- * @private
- * @param {Array} array The array to search.
- * @param {number} fromIndex The index to search from.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {number} Returns the index of the matched `NaN`, else `-1`.
- */
- function indexOfNaN(array, fromIndex, fromRight) {
- var length = array.length,
- index = fromIndex + (fromRight ? 0 : -1);
-
- while ((fromRight ? index-- : ++index < length)) {
- var other = array[index];
- if (other !== other) {
- return index;
- }
- }
- return -1;
- }
-
- /**
- * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
- *
- * @private
- * @param {Array} array The array to search.
- * @param {*} value The value to search for.
- * @param {number} fromIndex The index to search from.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */
- function baseIndexOf(array, value, fromIndex) {
- if (value !== value) {
- return indexOfNaN(array, fromIndex);
- }
- var index = fromIndex - 1,
- length = array.length;
-
- while (++index < length) {
- if (array[index] === value) {
- return index;
- }
- }
- return -1;
- }
-
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeMax$1 = Math.max;
-
- /**
- * Gets the index at which the first occurrence of `value` is found in `array`
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
- * for equality comparisons. If `fromIndex` is negative, it's used as the offset
- * from the end of `array`.
- *
- * @static
- * @memberOf _
- * @category Array
- * @param {Array} array The array to search.
- * @param {*} value The value to search for.
- * @param {number} [fromIndex=0] The index to search from.
- * @returns {number} Returns the index of the matched value, else `-1`.
- * @example
- *
- * _.indexOf([1, 2, 1, 2], 2);
- * // => 1
- *
- * // Search from the `fromIndex`.
- * _.indexOf([1, 2, 1, 2], 2, 2);
- * // => 3
- */
- function indexOf(array, value, fromIndex) {
- var length = array ? array.length : 0;
- if (!length) {
- return -1;
- }
- fromIndex = toInteger(fromIndex);
- if (fromIndex < 0) {
- fromIndex = nativeMax$1(length + fromIndex, 0);
- }
- return baseIndexOf(array, value, fromIndex);
- }
-
- function auto (tasks, concurrency, callback) {
- if (typeof arguments[1] === 'function') {
- // concurrency is optional, shift the args.
- callback = concurrency;
- concurrency = null;
- }
- callback = once(callback || noop);
- var keys$$ = keys(tasks);
- var remainingTasks = keys$$.length;
- if (!remainingTasks) {
- return callback(null);
- }
- if (!concurrency) {
- concurrency = remainingTasks;
- }
-
- var results = {};
- var runningTasks = 0;
- var hasError = false;
-
- var listeners = [];
- function addListener(fn) {
- listeners.unshift(fn);
- }
- function removeListener(fn) {
- var idx = indexOf(listeners, fn);
- if (idx >= 0) listeners.splice(idx, 1);
- }
- function taskComplete() {
- remainingTasks--;
- arrayEach(listeners.slice(), function (fn) {
- fn();
- });
- }
-
- addListener(function () {
- if (!remainingTasks) {
- callback(null, results);
- }
- });
-
- arrayEach(keys$$, function (k) {
- if (hasError) return;
- var task = isArray(tasks[k]) ? tasks[k] : [tasks[k]];
- var taskCallback = rest(function (err, args) {
- runningTasks--;
- if (args.length <= 1) {
- args = args[0];
- }
- if (err) {
- var safeResults = {};
- forOwn(results, function (val, rkey) {
- safeResults[rkey] = val;
- });
- safeResults[k] = args;
- hasError = true;
-
- callback(err, safeResults);
- } else {
- results[k] = args;
- setImmediate$1(taskComplete);
- }
- });
- var requires = task.slice(0, task.length - 1);
- // prevent dead-locks
- var len = requires.length;
- var dep;
- while (len--) {
- if (!(dep = tasks[requires[len]])) {
- throw new Error('Has non-existent dependency in ' + requires.join(', '));
- }
- if (isArray(dep) && indexOf(dep, k) >= 0) {
- throw new Error('Has cyclic dependencies');
- }
- }
- function ready() {
- return runningTasks < concurrency && !baseHas(results, k) && arrayEvery(requires, function (x) {
- return baseHas(results, x);
- });
- }
- if (ready()) {
- runningTasks++;
- task[task.length - 1](taskCallback, results);
- } else {
- addListener(listener);
- }
- function listener() {
- if (ready()) {
- runningTasks++;
- removeListener(listener);
- task[task.length - 1](taskCallback, results);
- }
- }
- });
- }
-
- /**
- * A specialized version of `_.map` for arrays without support for iteratee
- * shorthands.
- *
- * @private
- * @param {Array} array The array to iterate over.
- * @param {Function} iteratee The function invoked per iteration.
- * @returns {Array} Returns the new mapped array.
- */
- function arrayMap(array, iteratee) {
- var index = -1,
- length = array.length,
- result = Array(length);
-
- while (++index < length) {
- result[index] = iteratee(array[index], index, array);
- }
- return result;
- }
-
- function queue$1(worker, concurrency, payload) {
- if (concurrency == null) {
- concurrency = 1;
- } else if (concurrency === 0) {
- throw new Error('Concurrency must not be zero');
- }
- function _insert(q, data, pos, callback) {
- if (callback != null && typeof callback !== 'function') {
- throw new Error('task callback must be a function');
- }
- q.started = true;
- if (!isArray(data)) {
- data = [data];
- }
- if (data.length === 0 && q.idle()) {
- // call drain immediately if there are no tasks
- return setImmediate$1(function () {
- q.drain();
- });
- }
- arrayEach(data, function (task) {
- var item = {
- data: task,
- callback: callback || noop
- };
-
- if (pos) {
- q.tasks.unshift(item);
- } else {
- q.tasks.push(item);
- }
-
- if (q.tasks.length === q.concurrency) {
- q.saturated();
- }
- });
- setImmediate$1(q.process);
- }
- function _next(q, tasks) {
- return function () {
- workers -= 1;
-
- var removed = false;
- var args = arguments;
- arrayEach(tasks, function (task) {
- arrayEach(workersList, function (worker, index) {
- if (worker === task && !removed) {
- workersList.splice(index, 1);
- removed = true;
- }
- });
-
- task.callback.apply(task, args);
- });
- if (q.tasks.length + workers === 0) {
- q.drain();
- }
- q.process();
- };
- }
-
- var workers = 0;
- var workersList = [];
- var q = {
- tasks: [],
- concurrency: concurrency,
- payload: payload,
- saturated: noop,
- empty: noop,
- drain: noop,
- started: false,
- paused: false,
- push: function (data, callback) {
- _insert(q, data, false, callback);
- },
- kill: function () {
- q.drain = noop;
- q.tasks = [];
- },
- unshift: function (data, callback) {
- _insert(q, data, true, callback);
- },
- process: function () {
- while (!q.paused && workers < q.concurrency && q.tasks.length) {
-
- var tasks = q.payload ? q.tasks.splice(0, q.payload) : q.tasks.splice(0, q.tasks.length);
-
- var data = arrayMap(tasks, baseProperty('data'));
-
- if (q.tasks.length === 0) {
- q.empty();
- }
- workers += 1;
- workersList.push(tasks[0]);
- var cb = onlyOnce(_next(q, tasks));
- worker(data, cb);
- }
- },
- length: function () {
- return q.tasks.length;
- },
- running: function () {
- return workers;
- },
- workersList: function () {
- return workersList;
- },
- idle: function () {
- return q.tasks.length + workers === 0;
- },
- pause: function () {
- q.paused = true;
- },
- resume: function () {
- if (q.paused === false) {
- return;
- }
- q.paused = false;
- var resumeCount = Math.min(q.concurrency, q.tasks.length);
- // Need to call q.process once per concurrent
- // worker to preserve full concurrency after pause
- for (var w = 1; w <= resumeCount; w++) {
- setImmediate$1(q.process);
- }
- }
- };
- return q;
- }
-
- function cargo(worker, payload) {
- return queue$1(worker, 1, payload);
- }
-
- function reduce(arr, memo, iterator, cb) {
- eachOfSeries(arr, function (x, i, cb) {
- iterator(memo, x, function (err, v) {
- memo = v;
- cb(err);
- });
- }, function (err) {
- cb(err, memo);
- });
- }
-
- function seq() /* functions... */{
- var fns = arguments;
- return rest(function (args) {
- var that = this;
-
- var cb = args[args.length - 1];
- if (typeof cb == 'function') {
- args.pop();
- } else {
- cb = noop;
- }
-
- reduce(fns, args, function (newargs, fn, cb) {
- fn.apply(that, newargs.concat([rest(function (err, nextargs) {
- cb(err, nextargs);
- })]));
- }, function (err, results) {
- cb.apply(that, [err].concat(results));
- });
- });
- }
-
- var reverse = Array.prototype.reverse;
-
- function compose() /* functions... */{
- return seq.apply(null, reverse.call(arguments));
- }
-
- function concat$1(eachfn, arr, fn, callback) {
- var result = [];
- eachfn(arr, function (x, index, cb) {
- fn(x, function (err, y) {
- result = result.concat(y || []);
- cb(err);
- });
- }, function (err) {
- callback(err, result);
- });
- }
-
- function doParallel(fn) {
- return function (obj, iterator, callback) {
- return fn(eachOf, obj, iterator, callback);
- };
- }
-
- var concat = doParallel(concat$1);
-
- function doSeries(fn) {
- return function (obj, iterator, callback) {
- return fn(eachOfSeries, obj, iterator, callback);
- };
- }
-
- var concatSeries = doSeries(concat$1);
-
- var constant = rest(function (values) {
- var args = [null].concat(values);
- return function (cb) {
- return cb.apply(this, args);
- };
- });
-
- function _createTester(eachfn, check, getResult) {
- return function (arr, limit, iterator, cb) {
- function done(err) {
- if (cb) {
- if (err) {
- cb(err);
- } else {
- cb(null, getResult(false, void 0));
- }
- }
- }
- function iteratee(x, _, callback) {
- if (!cb) return callback();
- iterator(x, function (err, v) {
- if (cb) {
- if (err) {
- cb(err);
- cb = iterator = false;
- } else if (check(v)) {
- cb(null, getResult(true, x));
- cb = iterator = false;
- }
- }
- callback();
- });
- }
- if (arguments.length > 3) {
- eachfn(arr, limit, iteratee, done);
- } else {
- cb = iterator;
- iterator = limit;
- eachfn(arr, iteratee, done);
- }
- };
- }
-
- function _findGetResult(v, x) {
- return x;
- }
-
- var detect = _createTester(eachOf, identity, _findGetResult);
-
- function _eachOfLimit(limit) {
- return function (obj, iterator, callback) {
- callback = once(callback || noop);
- obj = obj || [];
- var nextKey = keyIterator(obj);
- if (limit <= 0) {
- return callback(null);
- }
- var done = false;
- var running = 0;
- var errored = false;
-
- (function replenish() {
- if (done && running <= 0) {
- return callback(null);
- }
-
- while (running < limit && !errored) {
- var key = nextKey();
- if (key === null) {
- done = true;
- if (running <= 0) {
- callback(null);
- }
- return;
- }
- running += 1;
- iterator(obj[key], key, onlyOnce(function (err) {
- running -= 1;
- if (err) {
- callback(err);
- errored = true;
- } else {
- replenish();
- }
- }));
- }
- })();
- };
- }
-
- function eachOfLimit(obj, limit, iterator, cb) {
- _eachOfLimit(limit)(obj, iterator, cb);
- }
-
- var detectLimit = _createTester(eachOfLimit, identity, _findGetResult);
-
- var detectSeries = _createTester(eachOfSeries, identity, _findGetResult);
-
- function consoleFunc(name) {
- return rest(function (fn, args) {
- fn.apply(null, args.concat([rest(function (err, args) {
- if (typeof console === 'object') {
- if (err) {
- if (console.error) {
- console.error(err);
- }
- } else if (console[name]) {
- arrayEach(args, function (x) {
- console[name](x);
- });
- }
- }
- })]));
- });
- }
-
- var dir = consoleFunc('dir');
-
- function during(test, iterator, cb) {
- cb = cb || noop;
-
- var next = rest(function (err, args) {
- if (err) {
- cb(err);
- } else {
- args.push(check);
- test.apply(this, args);
- }
- });
-
- var check = function (err, truth) {
- if (err) return cb(err);
- if (!truth) return cb(null);
- iterator(next);
- };
-
- test(check);
- }
-
- function doDuring(iterator, test, cb) {
- var calls = 0;
-
- during(function (next) {
- if (calls++ < 1) return next(null, true);
- test.apply(this, arguments);
- }, iterator, cb);
- }
-
- function whilst(test, iterator, cb) {
- cb = cb || noop;
- if (!test()) return cb(null);
- var next = rest(function (err, args) {
- if (err) return cb(err);
- if (test.apply(this, args)) return iterator(next);
- cb.apply(null, [null].concat(args));
- });
- iterator(next);
- }
-
- function doWhilst(iterator, test, cb) {
- var calls = 0;
- return whilst(function () {
- return ++calls <= 1 || test.apply(this, arguments);
- }, iterator, cb);
- }
-
- function doUntil(iterator, test, cb) {
- return doWhilst(iterator, function () {
- return !test.apply(this, arguments);
- }, cb);
- }
-
- function _withoutIndex(iterator) {
- return function (value, index, callback) {
- return iterator(value, callback);
- };
- }
-
- function each(arr, iterator, cb) {
- return eachOf(arr, _withoutIndex(iterator), cb);
- }
-
- function eachLimit(arr, limit, iterator, cb) {
- return _eachOfLimit(limit)(arr, _withoutIndex(iterator), cb);
- }
-
- function eachSeries(arr, iterator, cb) {
- return eachOfSeries(arr, _withoutIndex(iterator), cb);
- }
-
- function ensureAsync(fn) {
- return rest(function (args) {
- var callback = args.pop();
- var sync = true;
- args.push(function () {
- var innerArgs = arguments;
- if (sync) {
- setImmediate$1(function () {
- callback.apply(null, innerArgs);
- });
- } else {
- callback.apply(null, innerArgs);
- }
- });
- fn.apply(this, args);
- sync = false;
- });
- }
-
- function notId(v) {
- return !v;
- }
-
- var every = _createTester(eachOf, notId, notId);
-
- var everyLimit = _createTester(eachOfLimit, notId, notId);
-
- function _filter(eachfn, arr, iterator, callback) {
- var results = [];
- eachfn(arr, function (x, index, callback) {
- iterator(x, function (err, v) {
- if (err) {
- callback(err);
- } else {
- if (v) {
- results.push({ index: index, value: x });
- }
- callback();
- }
- });
- }, function (err) {
- if (err) {
- callback(err);
- } else {
- callback(null, arrayMap(results.sort(function (a, b) {
- return a.index - b.index;
- }), baseProperty('value')));
- }
- });
- }
-
- var filter = doParallel(_filter);
-
- function doParallelLimit(fn) {
- return function (obj, limit, iterator, callback) {
- return fn(_eachOfLimit(limit), obj, iterator, callback);
- };
- }
-
- var filterLimit = doParallelLimit(_filter);
-
- var filterSeries = doSeries(_filter);
-
- function forever(fn, cb) {
- var done = onlyOnce(cb || noop);
- var task = ensureAsync(fn);
-
- function next(err) {
- if (err) return done(err);
- task(next);
- }
- next();
- }
-
- function iterator (tasks) {
- function makeCallback(index) {
- function fn() {
- if (tasks.length) {
- tasks[index].apply(null, arguments);
- }
- return fn.next();
- }
- fn.next = function () {
- return index < tasks.length - 1 ? makeCallback(index + 1) : null;
- };
- return fn;
- }
- return makeCallback(0);
- }
-
- var log = consoleFunc('log');
-
- function _asyncMap(eachfn, arr, iterator, callback) {
- callback = once(callback || noop);
- arr = arr || [];
- var results = isArrayLike(arr) ? [] : {};
- eachfn(arr, function (value, index, callback) {
- iterator(value, function (err, v) {
- results[index] = v;
- callback(err);
- });
- }, function (err) {
- callback(err, results);
- });
- }
-
- var map = doParallel(_asyncMap);
-
- var mapLimit = doParallelLimit(_asyncMap);
-
- var mapSeries = doSeries(_asyncMap);
-
- /**
- * Checks if `value` is a global object.
- *
- * @private
- * @param {*} value The value to check.
- * @returns {null|Object} Returns `value` if it's a global object, else `null`.
- */
- function checkGlobal(value) {
- return (value && value.Object === Object) ? value : null;
- }
-
- /** Used to determine if values are of the language type `Object`. */
- var objectTypes = {
- 'function': true,
- 'object': true
- };
-
- /** Detect free variable `exports`. */
- var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null;
-
- /** Detect free variable `module`. */
- var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null;
-
- /** Detect free variable `global` from Node.js. */
- var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global);
-
- /** Detect free variable `self`. */
- var freeSelf = checkGlobal(objectTypes[typeof self] && self);
-
- /** Detect free variable `window`. */
- var freeWindow = checkGlobal(objectTypes[typeof window] && window);
-
- /** Detect `this` as the global object. */
- var thisGlobal = checkGlobal(objectTypes[typeof this] && this);
-
- /**
- * Used as a reference to the global object.
- *
- * The `this` value is used if it's the global object to avoid Greasemonkey's
- * restricted `window` object, otherwise the `window` object is used.
- */
- var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')();
-
- /** Built-in value references. */
- var Symbol = root.Symbol;
-
- /** `Object#toString` result references. */
- var symbolTag = '[object Symbol]';
-
- /** Used for built-in method references. */
- var objectProto$5 = Object.prototype;
-
- /**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
- * of values.
- */
- var objectToString$3 = objectProto$5.toString;
-
- /**
- * Checks if `value` is classified as a `Symbol` primitive or object.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
- * @example
- *
- * _.isSymbol(Symbol.iterator);
- * // => true
- *
- * _.isSymbol('abc');
- * // => false
- */
- function isSymbol(value) {
- return typeof value == 'symbol' ||
- (isObjectLike(value) && objectToString$3.call(value) == symbolTag);
- }
-
- /** Used as references for various `Number` constants. */
- var INFINITY$1 = 1 / 0;
-
- /** Used to convert symbols to primitives and strings. */
- var symbolProto = Symbol ? Symbol.prototype : undefined;
- var symbolToString = Symbol ? symbolProto.toString : undefined;
- /**
- * Converts `value` to a string if it's not one. An empty string is returned
- * for `null` and `undefined` values. The sign of `-0` is preserved.
- *
- * @static
- * @memberOf _
- * @category Lang
- * @param {*} value The value to process.
- * @returns {string} Returns the string.
- * @example
- *
- * _.toString(null);
- * // => ''
- *
- * _.toString(-0);
- * // => '-0'
- *
- * _.toString([1, 2, 3]);
- * // => '1,2,3'
- */
- function toString(value) {
- // Exit early for strings to avoid a performance hit in some environments.
- if (typeof value == 'string') {
- return value;
- }
- if (value == null) {
- return '';
- }
- if (isSymbol(value)) {
- return Symbol ? symbolToString.call(value) : '';
- }
- var result = (value + '');
- return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
- }
-
- /** Used to match property names within property paths. */
- var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g;
-
- /** Used to match backslashes in property paths. */
- var reEscapeChar = /\\(\\)?/g;
-
- /**
- * Converts `string` to a property path array.
- *
- * @private
- * @param {string} string The string to convert.
- * @returns {Array} Returns the property path array.
- */
- function stringToPath(string) {
- var result = [];
- toString(string).replace(rePropName, function(match, number, quote, string) {
- result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
- });
- return result;
- }
-
- /**
- * The base implementation of `_.toPath` which only converts `value` to a
- * path if it's not one.
- *
- * @private
- * @param {*} value The value to process.
- * @returns {Array} Returns the property path array.
- */
- function baseToPath(value) {
- return isArray(value) ? value : stringToPath(value);
- }
-
- var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
- var reIsPlainProp = /^\w*$/;
- /**
- * Checks if `value` is a property name and not a property path.
- *
- * @private
- * @param {*} value The value to check.
- * @param {Object} [object] The object to query keys on.
- * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
- */
- function isKey(value, object) {
- if (typeof value == 'number') {
- return true;
- }
- return !isArray(value) &&
- (reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
- (object != null && value in Object(object)));
- }
-
- /**
- * Gets the last element of `array`.
- *
- * @static
- * @memberOf _
- * @category Array
- * @param {Array} array The array to query.
- * @returns {*} Returns the last element of `array`.
- * @example
- *
- * _.last([1, 2, 3]);
- * // => 3
- */
- function last(array) {
- var length = array ? array.length : 0;
- return length ? array[length - 1] : undefined;
- }
-
- /**
- * The base implementation of `_.slice` without an iteratee call guard.
- *
- * @private
- * @param {Array} array The array to slice.
- * @param {number} [start=0] The start position.
- * @param {number} [end=array.length] The end position.
- * @returns {Array} Returns the slice of `array`.
- */
- function baseSlice(array, start, end) {
- var index = -1,
- length = array.length;
-
- if (start < 0) {
- start = -start > length ? 0 : (length + start);
- }
- end = end > length ? length : end;
- if (end < 0) {
- end += length;
- }
- length = start > end ? 0 : ((end - start) >>> 0);
- start >>>= 0;
-
- var result = Array(length);
- while (++index < length) {
- result[index] = array[index + start];
- }
- return result;
- }
-
- /**
- * The base implementation of `_.get` without support for default values.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array|string} path The path of the property to get.
- * @returns {*} Returns the resolved value.
- */
- function baseGet(object, path) {
- path = isKey(path, object) ? [path + ''] : baseToPath(path);
-
- var index = 0,
- length = path.length;
-
- while (object != null && index < length) {
- object = object[path[index++]];
- }
- return (index && index == length) ? object : undefined;
- }
-
- /**
- * Gets the value at `path` of `object`. If the resolved value is
- * `undefined` the `defaultValue` is used in its place.
- *
- * @static
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @param {Array|string} path The path of the property to get.
- * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.
- * @returns {*} Returns the resolved value.
- * @example
- *
- * var object = { 'a': [{ 'b': { 'c': 3 } }] };
- *
- * _.get(object, 'a[0].b.c');
- * // => 3
- *
- * _.get(object, ['a', '0', 'b', 'c']);
- * // => 3
- *
- * _.get(object, 'a.b.c', 'default');
- * // => 'default'
- */
- function get(object, path, defaultValue) {
- var result = object == null ? undefined : baseGet(object, path);
- return result === undefined ? defaultValue : result;
- }
-
- /**
- * Gets the parent value at `path` of `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array} path The path to get the parent value of.
- * @returns {*} Returns the parent value.
- */
- function parent(object, path) {
- return path.length == 1 ? object : get(object, baseSlice(path, 0, -1));
- }
-
- /**
- * Checks if `path` exists on `object`.
- *
- * @private
- * @param {Object} object The object to query.
- * @param {Array|string} path The path to check.
- * @param {Function} hasFunc The function to check properties.
- * @returns {boolean} Returns `true` if `path` exists, else `false`.
- */
- function hasPath(object, path, hasFunc) {
- if (object == null) {
- return false;
- }
- var result = hasFunc(object, path);
- if (!result && !isKey(path)) {
- path = baseToPath(path);
- object = parent(object, path);
- if (object != null) {
- path = last(path);
- result = hasFunc(object, path);
- }
- }
- var length = object ? object.length : undefined;
- return result || (
- !!length && isLength(length) && isIndex(path, length) &&
- (isArray(object) || isString(object) || isArguments(object))
- );
- }
-
- /**
- * Checks if `path` is a direct property of `object`.
- *
- * @static
- * @memberOf _
- * @category Object
- * @param {Object} object The object to query.
- * @param {Array|string} path The path to check.
- * @returns {boolean} Returns `true` if `path` exists, else `false`.
- * @example
- *
- * var object = { 'a': { 'b': { 'c': 3 } } };
- * var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) });
- *
- * _.has(object, 'a');
- * // => true
- *
- * _.has(object, 'a.b.c');
- * // => true
- *
- * _.has(object, ['a', 'b', 'c']);
- * // => true
- *
- * _.has(other, 'a');
- * // => false
- */
- function has(object, path) {
- return hasPath(object, path, baseHas);
- }
-
- function memoize(fn, hasher) {
- var memo = Object.create(null);
- var queues = Object.create(null);
- hasher = hasher || identity;
- var memoized = rest(function memoized(args) {
- var callback = args.pop();
- var key = hasher.apply(null, args);
- if (has(memo, key)) {
- 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) {
- 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;
- memoized.unmemoized = fn;
- return memoized;
- }
-
- var nexTick = typeof process === 'object' && typeof process.nextTick === 'function' ? process.nextTick : setImmediate$1;
-
- function _parallel(eachfn, tasks, callback) {
- callback = callback || noop;
- var results = isArrayLike(tasks) ? [] : {};
-
- eachfn(tasks, function (task, key, callback) {
- task(rest(function (err, args) {
- if (args.length <= 1) {
- args = args[0];
- }
- results[key] = args;
- callback(err);
- }));
- }, function (err) {
- callback(err, results);
- });
- }
-
- function parallel(tasks, cb) {
- return _parallel(eachOf, tasks, cb);
- }
-
- function parallelLimit(tasks, limit, cb) {
- return _parallel(_eachOfLimit(limit), tasks, cb);
- }
-
- function queue (worker, concurrency) {
- return queue$1(function (items, cb) {
- worker(items[0], cb);
- }, concurrency, 1);
- }
-
- function priorityQueue (worker, concurrency) {
- function _compareTasks(a, b) {
- return a.priority - b.priority;
- }
-
- function _binarySearch(sequence, item, compare) {
- var beg = -1,
- end = sequence.length - 1;
- while (beg < end) {
- var mid = beg + (end - beg + 1 >>> 1);
- if (compare(item, sequence[mid]) >= 0) {
- beg = mid;
- } else {
- end = mid - 1;
- }
- }
- return beg;
- }
-
- function _insert(q, data, priority, callback) {
- if (callback != null && typeof callback !== 'function') {
- throw new Error('task callback must be a function');
- }
- q.started = true;
- if (!isArray(data)) {
- data = [data];
- }
- if (data.length === 0) {
- // call drain immediately if there are no tasks
- return setImmediate$1(function () {
- q.drain();
- });
- }
- arrayEach(data, function (task) {
- var item = {
- data: task,
- priority: priority,
- callback: typeof callback === 'function' ? callback : noop
- };
-
- q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item);
-
- if (q.tasks.length === q.concurrency) {
- q.saturated();
- }
- setImmediate$1(q.process);
- });
- }
-
- // Start with a normal queue
- var q = queue(worker, concurrency);
-
- // Override push to accept second parameter representing priority
- q.push = function (data, priority, callback) {
- _insert(q, data, priority, callback);
- };
-
- // Remove unshift function
- delete q.unshift;
-
- return q;
- }
-
- var slice = Array.prototype.slice;
-
- function reduceRight(arr, memo, iterator, cb) {
- var reversed = slice.call(arr).reverse();
- reduce(reversed, memo, iterator, cb);
- }
-
- function reject$1(eachfn, arr, iterator, callback) {
- _filter(eachfn, arr, function (value, cb) {
- iterator(value, function (err, v) {
- if (err) {
- cb(err);
- } else {
- cb(null, !v);
- }
- });
- }, callback);
- }
-
- var reject = doParallel(reject$1);
-
- var rejectLimit = doParallelLimit(reject$1);
-
- var rejectSeries = doSeries(reject$1);
-
- function series(tasks, cb) {
- return _parallel(eachOfSeries, tasks, cb);
- }
-
- function retry(times, task, callback) {
- var DEFAULT_TIMES = 5;
- var DEFAULT_INTERVAL = 0;
-
- var attempts = [];
-
- var opts = {
- times: DEFAULT_TIMES,
- interval: DEFAULT_INTERVAL
- };
-
- function parseTimes(acc, t) {
- if (typeof t === 'number') {
- acc.times = parseInt(t, 10) || DEFAULT_TIMES;
- } else if (typeof t === 'object') {
- acc.times = parseInt(t.times, 10) || DEFAULT_TIMES;
- acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL;
- } else {
- throw new Error('Unsupported argument type for \'times\': ' + typeof t);
- }
- }
-
- var length = arguments.length;
- if (length < 1 || length > 3) {
- throw new Error('Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)');
- } else if (length <= 2 && typeof times === 'function') {
- callback = task;
- task = times;
- }
- if (typeof times !== 'function') {
- parseTimes(opts, times);
- }
- opts.callback = callback;
- opts.task = task;
-
- function wrappedTask(wrappedCallback, wrappedResults) {
- function retryAttempt(task, finalAttempt) {
- return function (seriesCallback) {
- task(function (err, result) {
- seriesCallback(!err || finalAttempt, {
- err: err,
- result: result
- });
- }, wrappedResults);
- };
- }
-
- function retryInterval(interval) {
- return function (seriesCallback) {
- setTimeout(function () {
- seriesCallback(null);
- }, interval);
- };
- }
-
- while (opts.times) {
-
- var finalAttempt = !(opts.times -= 1);
- attempts.push(retryAttempt(opts.task, finalAttempt));
- if (!finalAttempt && opts.interval > 0) {
- attempts.push(retryInterval(opts.interval));
- }
- }
-
- series(attempts, function (done, data) {
- data = data[data.length - 1];
- (wrappedCallback || opts.callback)(data.err, data.result);
- });
- }
-
- // If a callback is passed, run this as a controll flow
- return opts.callback ? wrappedTask() : wrappedTask;
- }
-
- var some = _createTester(eachOf, Boolean, identity);
-
- var someLimit = _createTester(eachOfLimit, Boolean, identity);
-
- function sortBy(arr, iterator, cb) {
- map(arr, function (x, cb) {
- iterator(x, function (err, criteria) {
- if (err) return cb(err);
- cb(null, { value: x, criteria: criteria });
- });
- }, function (err, results) {
- if (err) return cb(err);
- cb(null, arrayMap(results.sort(comparator), baseProperty('value')));
- });
-
- function comparator(left, right) {
- var a = left.criteria,
- b = right.criteria;
- return a < b ? -1 : a > b ? 1 : 0;
- }
- }
-
- /* Built-in method references for those with the same name as other `lodash` methods. */
- var nativeCeil = Math.ceil;
- var nativeMax$2 = Math.max;
- /**
- * The base implementation of `_.range` and `_.rangeRight` which doesn't
- * coerce arguments to numbers.
- *
- * @private
- * @param {number} start The start of the range.
- * @param {number} end The end of the range.
- * @param {number} step The value to increment or decrement by.
- * @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Array} Returns the new array of numbers.
- */
- function baseRange(start, end, step, fromRight) {
- var index = -1,
- length = nativeMax$2(nativeCeil((end - start) / (step || 1)), 0),
- result = Array(length);
-
- while (length--) {
- result[fromRight ? length : ++index] = start;
- start += step;
- }
- return result;
- }
-
- function times (count, iterator, callback) {
- map(baseRange(0, count, 1), iterator, callback);
- }
-
- function timeLimit(count, limit, iterator, cb) {
- return mapLimit(baseRange(0, count, 1), limit, iterator, cb);
- }
-
- function timesSeries (count, iterator, callback) {
- mapSeries(baseRange(0, count, 1), iterator, callback);
- }
-
- function transform(arr, memo, iterator, callback) {
- if (arguments.length === 3) {
- callback = iterator;
- iterator = memo;
- memo = isArray(arr) ? [] : {};
- }
-
- eachOf(arr, function (v, k, cb) {
- iterator(memo, v, k, cb);
- }, function (err) {
- callback(err, memo);
- });
- }
-
- function unmemoize(fn) {
- return function () {
- return (fn.unmemoized || fn).apply(null, arguments);
- };
- }
-
- function until(test, iterator, cb) {
- return whilst(function () {
- return !test.apply(this, arguments);
- }, iterator, cb);
- }
-
- function waterfall (tasks, cb) {
- cb = once(cb || noop);
- if (!isArray(tasks)) return cb(new Error('First argument to waterfall must be an array of functions'));
- if (!tasks.length) return cb();
-
- function wrapIterator(iterator) {
- return rest(function (err, args) {
- if (err) {
- cb.apply(null, [err].concat(args));
- } else {
- var next = iterator.next();
- if (next) {
- args.push(wrapIterator(next));
- } else {
- args.push(cb);
- }
- ensureAsync(iterator).apply(null, args);
- }
- });
- }
- wrapIterator(iterator(tasks))();
- }
-
- var index = {
- applyEach: applyEach,
- applyEachSeries: applyEachSeries,
- apply: apply,
- asyncify: asyncify,
- auto: auto,
- 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: each,
- eachLimit: eachLimit,
- eachOf: eachOf,
- eachOfLimit: eachOfLimit,
- eachOfSeries: eachOfSeries,
- eachSeries: eachSeries,
- ensureAsync: ensureAsync,
- every: every,
- everyLimit: everyLimit,
- filter: filter,
- filterLimit: filterLimit,
- filterSeries: filterSeries,
- forever: forever,
- iterator: iterator,
- log: log,
- map: map,
- mapLimit: mapLimit,
- mapSeries: mapSeries,
- memoize: memoize,
- nextTick: nexTick,
- parallel: parallel,
- parallelLimit: parallelLimit,
- priorityQueue: priorityQueue,
- queue: queue,
- reduce: reduce,
- reduceRight: reduceRight,
- reject: reject,
- rejectLimit: rejectLimit,
- rejectSeries: rejectSeries,
- retry: retry,
- seq: seq,
- series: series,
- setImmediate: setImmediate$1,
- some: some,
- someLimit: someLimit,
- sortBy: sortBy,
- times: times,
- timesLimit: timeLimit,
- timesSeries: timesSeries,
- transform: transform,
- unmemoize: unmemoize,
- until: until,
- waterfall: waterfall,
- whilst: whilst,
-
- // aliases
- all: every,
- any: some,
- forEach: each,
- forEachSeries: eachSeries,
- forEachLimit: eachLimit,
- 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;
- exports.asyncify = asyncify;
- exports.auto = auto;
- 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 = each;
- exports.eachLimit = eachLimit;
- exports.eachOf = eachOf;
- exports.eachOfLimit = eachOfLimit;
- exports.eachOfSeries = eachOfSeries;
- exports.eachSeries = eachSeries;
- exports.ensureAsync = ensureAsync;
- exports.every = every;
- exports.everyLimit = everyLimit;
- exports.filter = filter;
- exports.filterLimit = filterLimit;
- exports.filterSeries = filterSeries;
- exports.forever = forever;
- exports.iterator = iterator;
- exports.log = log;
- exports.map = map;
- exports.mapLimit = mapLimit;
- exports.mapSeries = mapSeries;
- exports.memoize = memoize;
- exports.nextTick = nexTick;
- exports.parallel = parallel;
- exports.parallelLimit = parallelLimit;
- exports.priorityQueue = priorityQueue;
- exports.queue = queue;
- exports.reduce = reduce;
- exports.reduceRight = reduceRight;
- exports.reject = reject;
- exports.rejectLimit = rejectLimit;
- exports.rejectSeries = rejectSeries;
- exports.retry = retry;
- exports.seq = seq;
- exports.series = series;
- exports.setImmediate = setImmediate$1;
- exports.some = some;
- exports.someLimit = someLimit;
- exports.sortBy = sortBy;
- 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.any = some;
- exports.forEach = each;
- exports.forEachSeries = eachSeries;
- exports.forEachLimit = eachLimit;
- 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;
-
-})); \ No newline at end of file
diff --git a/build/dist/async.min.js b/build/dist/async.min.js
deleted file mode 100644
index 2915a67..0000000
--- a/build/dist/async.min.js
+++ /dev/null
@@ -1,2 +0,0 @@
-!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(n.async={})}(this,function(n){"use strict";function t(n,t,r){var e=r.length;switch(e){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function r(n){var t=typeof n;return!!n&&("object"==t||"function"==t)}function e(n){var t=r(n)?nt.call(n):"";return t==Yn||t==Zn}function u(n){if(r(n)){var t=e(n.valueOf)?n.valueOf():n;n=r(t)?t+"":t}if("string"!=typeof n)return 0===n?n:+n;n=n.replace(rt,"");var u=ut.test(n);return u||it.test(n)?ot(n.slice(2),u?2:8):et.test(n)?tt:+n}function i(n){if(!n)return 0===n?n:0;if(n=u(n),n===ct||n===-ct){var t=0>n?-1:1;return t*ft}var r=n%1;return n===n?r?n-r:n:0}function o(n,r){if("function"!=typeof n)throw new TypeError(at);return r=lt(void 0===r?n.length-1:i(r),0),function(){for(var e=arguments,u=-1,i=lt(e.length-r,0),o=Array(i);++u<i;)o[u]=e[r+u];switch(r){case 0:return n.call(this,o);case 1:return n.call(this,e[0],o);case 2:return n.call(this,e[0],e[1],o)}var c=Array(r+1);for(u=-1;++u<r;)c[u]=e[u];return c[r]=o,t(n,this,c)}}function c(n){return o(function(t,r){var e=o(function(r){var e=this,u=r.pop();return n(t,function(n,t,u){n.apply(e,r.concat([u]))},u)});return r.length?e.apply(this,r):e})}function f(n,t){var r;if("function"!=typeof t)throw new TypeError(st);return n=i(n),function(){return--n>0&&(r=t.apply(this,arguments)),1>=n&&(t=void 0),r}}function a(n){return f(2,n)}function l(){}function s(n){return function(t){return null==t?void 0:t[n]}}function p(n){return"number"==typeof n&&n>-1&&n%1==0&&yt>=n}function y(n){return null!=n&&!("function"==typeof n&&e(n))&&p(pt(n))}function h(n,t){return vt.call(n,t)||"object"==typeof n&&t in n&&null===mt(n)}function v(n){return dt(Object(n))}function m(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function d(n){return!!n&&"object"==typeof n}function g(n){return d(n)&&y(n)}function b(n){return g(n)&&kt.call(n,"callee")&&(!jt.call(n,"callee")||wt.call(n)==gt)}function k(n){return"string"==typeof n||!St(n)&&d(n)&&Lt.call(n)==Ot}function w(n){var t=n?n.length:void 0;return p(t)&&(St(n)||k(n)||b(n))?m(t,String):null}function j(n,t){return n="number"==typeof n||At.test(n)?+n:-1,t=null==t?xt:t,n>-1&&n%1==0&&t>n}function S(n){var t=n&&n.constructor,r="function"==typeof t&&t.prototype||Tt;return n===r}function O(n){var t=S(n);if(!t&&!y(n))return v(n);var r=w(n),e=!!r,u=r||[],i=u.length;for(var o in n)!h(n,o)||e&&("length"==o||j(o,i))||t&&"constructor"==o||u.push(o);return u}function E(n){var t,r=-1;if(y(n))return t=n.length,function(){return r++,t>r?r:null};var e=O(n);return t=e.length,function(){return r++,t>r?e[r]:null}}function L(n){return function(){if(null===n)throw new Error("Callback was already called.");n.apply(this,arguments),n=null}}function x(n,t,r){function e(n){o--,n?r(n):null===u&&0>=o&&r(null)}r=a(r||l),n=n||[];for(var u,i=E(n),o=0;null!=(u=i());)o+=1,t(n[u],u,L(e));0===o&&r(null)}function A(n,t,r){function e(){var o=!0;return null===i?r(null):(t(n[i],i,L(function(n){if(n)r(n);else{if(i=u(),null===i)return r(null);o?$t(e):e()}})),void(o=!1))}r=a(r||l),n=n||[];var u=E(n),i=u();e()}function T(n){return o(function(t){var e,u=t.pop();try{e=n.apply(this,t)}catch(i){return u(i)}r(e)&&"function"==typeof e.then?e.then(function(n){u(null,n)})["catch"](function(n){u(n.message?n:new Error(n))}):u(null,e)})}function I(n,t){for(var r=-1,e=n.length;++r<e&&t(n[r],r,n)!==!1;);return n}function z(n,t){for(var r=-1,e=n.length;++r<e;)if(!t(n[r],r,n))return!1;return!0}function $(n){return function(t,r,e){for(var u=-1,i=Object(t),o=e(t),c=o.length;c--;){var f=o[n?c:++u];if(r(i[f],f,i)===!1)break}return t}}function M(n,t){return n&&Bt(n,t,O)}function q(n){return n}function B(n){return"function"==typeof n?n:q}function F(n,t){return n&&M(n,B(t))}function P(n,t,r){for(var e=n.length,u=t+(r?0:-1);r?u--:++u<e;){var i=n[u];if(i!==i)return u}return-1}function U(n,t,r){if(t!==t)return P(n,r);for(var e=r-1,u=n.length;++e<u;)if(n[e]===t)return e;return-1}function C(n,t,r){var e=n?n.length:0;return e?(r=i(r),0>r&&(r=Ft(e+r,0)),U(n,t,r)):-1}function D(n,t,r){function e(n){v.unshift(n)}function u(n){var t=C(v,n);t>=0&&v.splice(t,1)}function i(){f--,I(v.slice(),function(n){n()})}"function"==typeof arguments[1]&&(r=t,t=null),r=a(r||l);var c=O(n),f=c.length;if(!f)return r(null);t||(t=f);var s={},p=0,y=!1,v=[];e(function(){f||r(null,s)}),I(c,function(c){function f(){return t>p&&!h(s,c)&&z(d,function(n){return h(s,n)})}function a(){f()&&(p++,u(a),v[v.length-1](m,s))}if(!y){for(var l,v=St(n[c])?n[c]:[n[c]],m=o(function(n,t){if(p--,t.length<=1&&(t=t[0]),n){var e={};F(s,function(n,t){e[t]=n}),e[c]=t,y=!0,r(n,e)}else s[c]=t,$t(i)}),d=v.slice(0,v.length-1),g=d.length;g--;){if(!(l=n[d[g]]))throw new Error("Has non-existent dependency in "+d.join(", "));if(St(l)&&C(l,c)>=0)throw new Error("Has cyclic dependencies")}f()?(p++,v[v.length-1](m,s)):e(a)}})}function H(n,t){for(var r=-1,e=n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function N(n,t,r){function e(n,t,r,e){if(null!=e&&"function"!=typeof e)throw new Error("task callback must be a function");return n.started=!0,St(t)||(t=[t]),0===t.length&&n.idle()?$t(function(){n.drain()}):(I(t,function(t){var u={data:t,callback:e||l};r?n.tasks.unshift(u):n.tasks.push(u),n.tasks.length===n.concurrency&&n.saturated()}),void $t(n.process))}function u(n,t){return function(){i-=1;var r=!1,e=arguments;I(t,function(n){I(o,function(t,e){t!==n||r||(o.splice(e,1),r=!0)}),n.callback.apply(n,e)}),n.tasks.length+i===0&&n.drain(),n.process()}}if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var i=0,o=[],c={tasks:[],concurrency:t,payload:r,saturated:l,empty:l,drain:l,started:!1,paused:!1,push:function(n,t){e(c,n,!1,t)},kill:function(){c.drain=l,c.tasks=[]},unshift:function(n,t){e(c,n,!0,t)},process:function(){for(;!c.paused&&i<c.concurrency&&c.tasks.length;){var t=c.payload?c.tasks.splice(0,c.payload):c.tasks.splice(0,c.tasks.length),r=H(t,s("data"));0===c.tasks.length&&c.empty(),i+=1,o.push(t[0]);var e=L(u(c,t));n(r,e)}},length:function(){return c.tasks.length},running:function(){return i},workersList:function(){return o},idle:function(){return c.tasks.length+i===0},pause:function(){c.paused=!0},resume:function(){if(c.paused!==!1){c.paused=!1;for(var n=Math.min(c.concurrency,c.tasks.length),t=1;n>=t;t++)$t(c.process)}}};return c}function Q(n,t){return N(n,1,t)}function R(n,t,r,e){A(n,function(n,e,u){r(t,n,function(n,r){t=r,u(n)})},function(n){e(n,t)})}function W(){var n=arguments;return o(function(t){var r=this,e=t[t.length-1];"function"==typeof e?t.pop():e=l,R(n,t,function(n,t,e){t.apply(r,n.concat([o(function(n,t){e(n,t)})]))},function(n,t){e.apply(r,[n].concat(t))})})}function G(){return W.apply(null,Pt.call(arguments))}function J(n,t,r,e){var u=[];n(t,function(n,t,e){r(n,function(n,t){u=u.concat(t||[]),e(n)})},function(n){e(n,u)})}function K(n){return function(t,r,e){return n(x,t,r,e)}}function V(n){return function(t,r,e){return n(A,t,r,e)}}function X(n,t,r){return function(e,u,i,o){function c(n){o&&(n?o(n):o(null,r(!1,void 0)))}function f(n,e,u){return o?void i(n,function(e,c){o&&(e?(o(e),o=i=!1):t(c)&&(o(null,r(!0,n)),o=i=!1)),u()}):u()}arguments.length>3?n(e,u,f,c):(o=i,i=u,n(e,f,c))}}function Y(n,t){return t}function Z(n){return function(t,r,e){e=a(e||l),t=t||[];var u=E(t);if(0>=n)return e(null);var i=!1,o=0,c=!1;!function f(){if(i&&0>=o)return e(null);for(;n>o&&!c;){var a=u();if(null===a)return i=!0,void(0>=o&&e(null));o+=1,r(t[a],a,L(function(n){o-=1,n?(e(n),c=!0):f()}))}}()}}function _(n,t,r,e){Z(t)(n,r,e)}function nn(n){return o(function(t,r){t.apply(null,r.concat([o(function(t,r){"object"==typeof console&&(t?console.error&&console.error(t):console[n]&&I(r,function(t){console[n](t)}))})]))})}function tn(n,t,r){r=r||l;var e=o(function(t,e){t?r(t):(e.push(u),n.apply(this,e))}),u=function(n,u){return n?r(n):u?void t(e):r(null)};n(u)}function rn(n,t,r){var e=0;tn(function(n){return e++<1?n(null,!0):void t.apply(this,arguments)},n,r)}function en(n,t,r){if(r=r||l,!n())return r(null);var e=o(function(u,i){return u?r(u):n.apply(this,i)?t(e):void r.apply(null,[null].concat(i))});t(e)}function un(n,t,r){var e=0;return en(function(){return++e<=1||t.apply(this,arguments)},n,r)}function on(n,t,r){return un(n,function(){return!t.apply(this,arguments)},r)}function cn(n){return function(t,r,e){return n(t,e)}}function fn(n,t,r){return x(n,cn(t),r)}function an(n,t,r,e){return Z(t)(n,cn(r),e)}function ln(n,t,r){return A(n,cn(t),r)}function sn(n){return o(function(t){var r=t.pop(),e=!0;t.push(function(){var n=arguments;e?$t(function(){r.apply(null,n)}):r.apply(null,n)}),n.apply(this,t),e=!1})}function pn(n){return!n}function yn(n,t,r,e){var u=[];n(t,function(n,t,e){r(n,function(r,i){r?e(r):(i&&u.push({index:t,value:n}),e())})},function(n){n?e(n):e(null,H(u.sort(function(n,t){return n.index-t.index}),s("value")))})}function hn(n){return function(t,r,e,u){return n(Z(r),t,e,u)}}function vn(n,t){function r(n){return n?e(n):void u(r)}var e=L(t||l),u=sn(n);r()}function mn(n){function t(r){function e(){return n.length&&n[r].apply(null,arguments),e.next()}return e.next=function(){return r<n.length-1?t(r+1):null},e}return t(0)}function dn(n,t,r,e){e=a(e||l),t=t||[];var u=y(t)?[]:{};n(t,function(n,t,e){r(n,function(n,r){u[t]=r,e(n)})},function(n){e(n,u)})}function gn(n){return n&&n.Object===Object?n:null}function bn(n){return"symbol"==typeof n||d(n)&&sr.call(n)==ar}function kn(n){if("string"==typeof n)return n;if(null==n)return"";if(bn(n))return fr?hr.call(n):"";var t=n+"";return"0"==t&&1/n==-pr?"-0":t}function wn(n){var t=[];return kn(n).replace(vr,function(n,r,e,u){t.push(e?u.replace(mr,"$1"):r||n)}),t}function jn(n){return St(n)?n:wn(n)}function Sn(n,t){return"number"==typeof n?!0:!St(n)&&(gr.test(n)||!dr.test(n)||null!=t&&n in Object(t))}function On(n){var t=n?n.length:0;return t?n[t-1]:void 0}function En(n,t,r){var e=-1,u=n.length;0>t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0;for(var i=Array(u);++e<u;)i[e]=n[e+t];return i}function Ln(n,t){t=Sn(t,n)?[t+""]:jn(t);for(var r=0,e=t.length;null!=n&&e>r;)n=n[t[r++]];return r&&r==e?n:void 0}function xn(n,t,r){var e=null==n?void 0:Ln(n,t);return void 0===e?r:e}function An(n,t){return 1==t.length?n:xn(n,En(t,0,-1))}function Tn(n,t,r){if(null==n)return!1;var e=r(n,t);e||Sn(t)||(t=jn(t),n=An(n,t),null!=n&&(t=On(t),e=r(n,t)));var u=n?n.length:void 0;return e||!!u&&p(u)&&j(t,u)&&(St(n)||k(n)||b(n))}function In(n,t){return Tn(n,t,h)}function zn(n,t){var r=Object.create(null),e=Object.create(null);t=t||q;var u=o(function(u){var i=u.pop(),c=t.apply(null,u);In(r,c)?$t(function(){i.apply(null,r[c])}):In(e,c)?e[c].push(i):(e[c]=[i],n.apply(null,u.concat([o(function(n){r[c]=n;var t=e[c];delete e[c];for(var u=0,i=t.length;i>u;u++)t[u].apply(null,n)})])))});return u.memo=r,u.unmemoized=n,u}function $n(n,t,r){r=r||l;var e=y(t)?[]:{};n(t,function(n,t,r){n(o(function(n,u){u.length<=1&&(u=u[0]),e[t]=u,r(n)}))},function(n){r(n,e)})}function Mn(n,t){return $n(x,n,t)}function qn(n,t,r){return $n(Z(t),n,r)}function Bn(n,t){return N(function(t,r){n(t[0],r)},t,1)}function Fn(n,t){function r(n,t){return n.priority-t.priority}function e(n,t,r){for(var e=-1,u=n.length-1;u>e;){var i=e+(u-e+1>>>1);r(t,n[i])>=0?e=i:u=i-1}return e}function u(n,t,u,i){if(null!=i&&"function"!=typeof i)throw new Error("task callback must be a function");return n.started=!0,St(t)||(t=[t]),0===t.length?$t(function(){n.drain()}):void I(t,function(t){var o={data:t,priority:u,callback:"function"==typeof i?i:l};n.tasks.splice(e(n.tasks,o,r)+1,0,o),n.tasks.length===n.concurrency&&n.saturated(),$t(n.process)})}var i=Bn(n,t);return i.push=function(n,t,r){u(i,n,t,r)},delete i.unshift,i}function Pn(n,t,r,e){var u=kr.call(n).reverse();R(u,t,r,e)}function Un(n,t,r,e){yn(n,t,function(n,t){r(n,function(n,r){n?t(n):t(null,!r)})},e)}function Cn(n,t){return $n(A,n,t)}function Dn(n,t,r){function e(n,t){if("number"==typeof t)n.times=parseInt(t,10)||i;else{if("object"!=typeof t)throw new Error("Unsupported argument type for 'times': "+typeof t);n.times=parseInt(t.times,10)||i,n.interval=parseInt(t.interval,10)||o}}function u(n,t){function r(n,r){return function(e){n(function(n,t){e(!n||r,{err:n,result:t})},t)}}function e(n){return function(t){setTimeout(function(){t(null)},n)}}for(;f.times;){var u=!(f.times-=1);c.push(r(f.task,u)),!u&&f.interval>0&&c.push(e(f.interval))}Cn(c,function(t,r){r=r[r.length-1],(n||f.callback)(r.err,r.result)})}var i=5,o=0,c=[],f={times:i,interval:o},a=arguments.length;if(1>a||a>3)throw new Error("Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)");return 2>=a&&"function"==typeof n&&(r=t,t=n),"function"!=typeof n&&e(f,n),f.callback=r,f.task=t,f.callback?u():u}function Hn(n,t,r){function e(n,t){var r=n.criteria,e=t.criteria;return e>r?-1:r>e?1:0}Yt(n,function(n,r){t(n,function(t,e){return t?r(t):void r(null,{value:n,criteria:e})})},function(n,t){return n?r(n):void r(null,H(t.sort(e),s("value")))})}function Nn(n,t,r,e){for(var u=-1,i=xr(Lr((t-n)/(r||1)),0),o=Array(i);i--;)o[e?i:++u]=n,n+=r;return o}function Qn(n,t,r){Yt(Nn(0,n,1),t,r)}function Rn(n,t,r,e){return Zt(Nn(0,n,1),t,r,e)}function Wn(n,t,r){_t(Nn(0,n,1),t,r)}function Gn(n,t,r,e){3===arguments.length&&(e=r,r=t,t=St(n)?[]:{}),x(n,function(n,e,u){r(t,n,e,u)},function(n){e(n,t)})}function Jn(n){return function(){return(n.unmemoized||n).apply(null,arguments)}}function Kn(n,t,r){return en(function(){return!n.apply(this,arguments)},t,r)}function Vn(n,t){function r(n){return o(function(e,u){if(e)t.apply(null,[e].concat(u));else{var i=n.next();i?u.push(r(i)):u.push(t),sn(n).apply(null,u)}})}return t=a(t||l),St(n)?n.length?void r(mn(n))():t():t(new Error("First argument to waterfall must be an array of functions"))}var Xn,Yn="[object Function]",Zn="[object GeneratorFunction]",_n=Object.prototype,nt=_n.toString,tt=NaN,rt=/^\s+|\s+$/g,et=/^[-+]0x[0-9a-f]+$/i,ut=/^0b[01]+$/i,it=/^0o[0-7]+$/i,ot=parseInt,ct=1/0,ft=1.7976931348623157e308,at="Expected a function",lt=Math.max,st="Expected a function",pt=s("length"),yt=9007199254740991,ht=Object.prototype,vt=ht.hasOwnProperty,mt=Object.getPrototypeOf,dt=Object.keys,gt="[object Arguments]",bt=Object.prototype,kt=bt.hasOwnProperty,wt=bt.toString,jt=bt.propertyIsEnumerable,St=Array.isArray,Ot="[object String]",Et=Object.prototype,Lt=Et.toString,xt=9007199254740991,At=/^(?:0|[1-9]\d*)$/,Tt=Object.prototype,It=c(x),zt="function"==typeof setImmediate&&setImmediate;Xn=zt?function(n){zt(n)}:"object"==typeof process&&"function"==typeof process.nextTick?process.nextTick:function(n){setTimeout(n,0)};var $t=Xn,Mt=c(A),qt=o(function(n,t){return o(function(r){return n.apply(null,t.concat(r))})}),Bt=$(),Ft=Math.max,Pt=Array.prototype.reverse,Ut=K(J),Ct=V(J),Dt=o(function(n){var t=[null].concat(n);return function(n){return n.apply(this,t)}}),Ht=X(x,q,Y),Nt=X(_,q,Y),Qt=X(A,q,Y),Rt=nn("dir"),Wt=X(x,pn,pn),Gt=X(_,pn,pn),Jt=K(yn),Kt=hn(yn),Vt=V(yn),Xt=nn("log"),Yt=K(dn),Zt=hn(dn),_t=V(dn),nr={"function":!0,object:!0},tr=nr[typeof n]&&n&&!n.nodeType?n:null,rr=nr[typeof module]&&module&&!module.nodeType?module:null,er=gn(tr&&rr&&"object"==typeof global&&global),ur=gn(nr[typeof self]&&self),ir=gn(nr[typeof window]&&window),or=gn(nr[typeof this]&&this),cr=er||ir!==(or&&or.window)&&ir||ur||or||Function("return this")(),fr=cr.Symbol,ar="[object Symbol]",lr=Object.prototype,sr=lr.toString,pr=1/0,yr=fr?fr.prototype:void 0,hr=fr?yr.toString:void 0,vr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,mr=/\\(\\)?/g,dr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,gr=/^\w*$/,br="object"==typeof process&&"function"==typeof process.nextTick?process.nextTick:$t,kr=Array.prototype.slice,wr=K(Un),jr=hn(Un),Sr=V(Un),Or=X(x,Boolean,q),Er=X(_,Boolean,q),Lr=Math.ceil,xr=Math.max,Ar={applyEach:It,applyEachSeries:Mt,apply:qt,asyncify:T,auto:D,cargo:Q,compose:G,concat:Ut,concatSeries:Ct,constant:Dt,detect:Ht,detectLimit:Nt,detectSeries:Qt,dir:Rt,doDuring:rn,doUntil:on,doWhilst:un,during:tn,each:fn,eachLimit:an,eachOf:x,eachOfLimit:_,eachOfSeries:A,eachSeries:ln,ensureAsync:sn,every:Wt,everyLimit:Gt,filter:Jt,filterLimit:Kt,filterSeries:Vt,forever:vn,iterator:mn,log:Xt,map:Yt,mapLimit:Zt,mapSeries:_t,memoize:zn,nextTick:br,parallel:Mn,parallelLimit:qn,priorityQueue:Fn,queue:Bn,reduce:R,reduceRight:Pn,reject:wr,rejectLimit:jr,rejectSeries:Sr,retry:Dn,seq:W,series:Cn,setImmediate:$t,some:Or,someLimit:Er,sortBy:Hn,times:Qn,timesLimit:Rn,timesSeries:Wn,transform:Gn,unmemoize:Jn,until:Kn,waterfall:Vn,whilst:en,all:Wt,any:Or,forEach:fn,forEachSeries:ln,forEachLimit:an,forEachOf:x,forEachOfSeries:A,forEachOfLimit:_,inject:R,foldl:R,foldr:Pn,select:Jt,selectLimit:Kt,selectSeries:Vt,wrapSync:T};n["default"]=Ar,n.applyEach=It,n.applyEachSeries=Mt,n.apply=qt,n.asyncify=T,n.auto=D,n.cargo=Q,n.compose=G,n.concat=Ut,n.concatSeries=Ct,n.constant=Dt,n.detect=Ht,n.detectLimit=Nt,n.detectSeries=Qt,n.dir=Rt,n.doDuring=rn,n.doUntil=on,n.doWhilst=un,n.during=tn,n.each=fn,n.eachLimit=an,n.eachOf=x,n.eachOfLimit=_,n.eachOfSeries=A,n.eachSeries=ln,n.ensureAsync=sn,n.every=Wt,n.everyLimit=Gt,n.filter=Jt,n.filterLimit=Kt,n.filterSeries=Vt,n.forever=vn,n.iterator=mn,n.log=Xt,n.map=Yt,n.mapLimit=Zt,n.mapSeries=_t,n.memoize=zn,n.nextTick=br,n.parallel=Mn,n.parallelLimit=qn,n.priorityQueue=Fn,n.queue=Bn,n.reduce=R,n.reduceRight=Pn,n.reject=wr,n.rejectLimit=jr,n.rejectSeries=Sr,n.retry=Dn,n.seq=W,n.series=Cn,n.setImmediate=$t,n.some=Or,n.someLimit=Er,n.sortBy=Hn,n.times=Qn,n.timesLimit=Rn,n.timesSeries=Wn,n.transform=Gn,n.unmemoize=Jn,n.until=Kn,n.waterfall=Vn,n.whilst=en,n.all=Wt,n.any=Or,n.forEach=fn,n.forEachSeries=ln,n.forEachLimit=an,n.forEachOf=x,n.forEachOfSeries=A,n.forEachOfLimit=_,n.inject=R,n.foldl=R,n.foldr=Pn,n.select=Jt,n.selectLimit=Kt,n.selectSeries=Vt,n.wrapSync=T});
-//# sourceMappingURL=dist/async.min.map \ No newline at end of file
diff --git a/build/doDuring.js b/build/doDuring.js
deleted file mode 100644
index 3ad194c..0000000
--- a/build/doDuring.js
+++ /dev/null
@@ -1,22 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = doDuring;
-
-var _during = require('./during');
-
-var _during2 = _interopRequireDefault(_during);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function doDuring(iterator, test, cb) {
- var calls = 0;
-
- (0, _during2.default)(function (next) {
- if (calls++ < 1) return next(null, true);
- test.apply(this, arguments);
- }, iterator, cb);
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/doUntil.js b/build/doUntil.js
deleted file mode 100644
index 31ab25a..0000000
--- a/build/doUntil.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = doUntil;
-
-var _doWhilst = require('./doWhilst');
-
-var _doWhilst2 = _interopRequireDefault(_doWhilst);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function doUntil(iterator, test, cb) {
- return (0, _doWhilst2.default)(iterator, function () {
- return !test.apply(this, arguments);
- }, cb);
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/doWhilst.js b/build/doWhilst.js
deleted file mode 100644
index 5e0e6ff..0000000
--- a/build/doWhilst.js
+++ /dev/null
@@ -1,20 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = doWhilst;
-
-var _whilst = require('./whilst');
-
-var _whilst2 = _interopRequireDefault(_whilst);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function doWhilst(iterator, test, cb) {
- var calls = 0;
- return (0, _whilst2.default)(function () {
- return ++calls <= 1 || test.apply(this, arguments);
- }, iterator, cb);
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/during.js b/build/during.js
deleted file mode 100644
index 9729ceb..0000000
--- a/build/during.js
+++ /dev/null
@@ -1,38 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = during;
-
-var _noop = require('lodash/noop');
-
-var _noop2 = _interopRequireDefault(_noop);
-
-var _rest = require('lodash/rest');
-
-var _rest2 = _interopRequireDefault(_rest);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function during(test, iterator, cb) {
- cb = cb || _noop2.default;
-
- var next = (0, _rest2.default)(function (err, args) {
- if (err) {
- cb(err);
- } else {
- args.push(check);
- test.apply(this, args);
- }
- });
-
- var check = function (err, truth) {
- if (err) return cb(err);
- if (!truth) return cb(null);
- iterator(next);
- };
-
- test(check);
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/each.js b/build/each.js
deleted file mode 100644
index 1af461f..0000000
--- a/build/each.js
+++ /dev/null
@@ -1,21 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = each;
-
-var _eachOf = require('./eachOf');
-
-var _eachOf2 = _interopRequireDefault(_eachOf);
-
-var _withoutIndex = require('./internal/withoutIndex');
-
-var _withoutIndex2 = _interopRequireDefault(_withoutIndex);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function each(arr, iterator, cb) {
- return (0, _eachOf2.default)(arr, (0, _withoutIndex2.default)(iterator), cb);
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/eachLimit.js b/build/eachLimit.js
deleted file mode 100644
index 17ff2a4..0000000
--- a/build/eachLimit.js
+++ /dev/null
@@ -1,21 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = eachLimit;
-
-var _eachOfLimit = require('./internal/eachOfLimit');
-
-var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
-
-var _withoutIndex = require('./internal/withoutIndex');
-
-var _withoutIndex2 = _interopRequireDefault(_withoutIndex);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function eachLimit(arr, limit, iterator, cb) {
- return (0, _eachOfLimit2.default)(limit)(arr, (0, _withoutIndex2.default)(iterator), cb);
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/eachOf.js b/build/eachOf.js
deleted file mode 100644
index 31214fa..0000000
--- a/build/eachOf.js
+++ /dev/null
@@ -1,53 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = eachOf;
-
-var _once = require('lodash/once');
-
-var _once2 = _interopRequireDefault(_once);
-
-var _noop = require('lodash/noop');
-
-var _noop2 = _interopRequireDefault(_noop);
-
-var _keyIterator = require('./internal/keyIterator');
-
-var _keyIterator2 = _interopRequireDefault(_keyIterator);
-
-var _onlyOnce = require('./internal/onlyOnce');
-
-var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function eachOf(object, iterator, callback) {
- callback = (0, _once2.default)(callback || _noop2.default);
- object = object || [];
-
- var iter = (0, _keyIterator2.default)(object);
- var key,
- completed = 0;
-
- while ((key = iter()) != null) {
- completed += 1;
- iterator(object[key], key, (0, _onlyOnce2.default)(done));
- }
-
- if (completed === 0) callback(null);
-
- function done(err) {
- completed--;
- if (err) {
- callback(err);
- }
- // Check key is null in case iterator isn't exhausted
- // and done resolved synchronously.
- else if (key === null && completed <= 0) {
- callback(null);
- }
- }
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/eachOfLimit.js b/build/eachOfLimit.js
deleted file mode 100644
index 320849b..0000000
--- a/build/eachOfLimit.js
+++ /dev/null
@@ -1,17 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = eachOfLimit;
-
-var _eachOfLimit2 = require('./internal/eachOfLimit');
-
-var _eachOfLimit3 = _interopRequireDefault(_eachOfLimit2);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function eachOfLimit(obj, limit, iterator, cb) {
- (0, _eachOfLimit3.default)(limit)(obj, iterator, cb);
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/eachOfSeries.js b/build/eachOfSeries.js
deleted file mode 100644
index 50e2ab6..0000000
--- a/build/eachOfSeries.js
+++ /dev/null
@@ -1,61 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = eachOfSeries;
-
-var _once = require('lodash/once');
-
-var _once2 = _interopRequireDefault(_once);
-
-var _noop = require('lodash/noop');
-
-var _noop2 = _interopRequireDefault(_noop);
-
-var _keyIterator = require('./internal/keyIterator');
-
-var _keyIterator2 = _interopRequireDefault(_keyIterator);
-
-var _onlyOnce = require('./internal/onlyOnce');
-
-var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
-
-var _setImmediate = require('./setImmediate');
-
-var _setImmediate2 = _interopRequireDefault(_setImmediate);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function eachOfSeries(obj, iterator, callback) {
- callback = (0, _once2.default)(callback || _noop2.default);
- obj = obj || [];
- var nextKey = (0, _keyIterator2.default)(obj);
- var key = nextKey();
-
- function iterate() {
- var sync = true;
- if (key === null) {
- return callback(null);
- }
- iterator(obj[key], key, (0, _onlyOnce2.default)(function (err) {
- if (err) {
- callback(err);
- } else {
- key = nextKey();
- if (key === null) {
- return callback(null);
- } else {
- if (sync) {
- (0, _setImmediate2.default)(iterate);
- } else {
- iterate();
- }
- }
- }
- }));
- sync = false;
- }
- iterate();
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/eachSeries.js b/build/eachSeries.js
deleted file mode 100644
index 929c95c..0000000
--- a/build/eachSeries.js
+++ /dev/null
@@ -1,21 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = eachSeries;
-
-var _eachOfSeries = require('./eachOfSeries');
-
-var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
-
-var _withoutIndex = require('./internal/withoutIndex');
-
-var _withoutIndex2 = _interopRequireDefault(_withoutIndex);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function eachSeries(arr, iterator, cb) {
- return (0, _eachOfSeries2.default)(arr, (0, _withoutIndex2.default)(iterator), cb);
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/ensureAsync.js b/build/ensureAsync.js
deleted file mode 100644
index 8fdef97..0000000
--- a/build/ensureAsync.js
+++ /dev/null
@@ -1,36 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = ensureAsync;
-
-var _rest = require('lodash/rest');
-
-var _rest2 = _interopRequireDefault(_rest);
-
-var _setImmediate = require('./internal/setImmediate');
-
-var _setImmediate2 = _interopRequireDefault(_setImmediate);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function ensureAsync(fn) {
- return (0, _rest2.default)(function (args) {
- var callback = args.pop();
- var sync = true;
- args.push(function () {
- var innerArgs = arguments;
- if (sync) {
- (0, _setImmediate2.default)(function () {
- callback.apply(null, innerArgs);
- });
- } else {
- callback.apply(null, innerArgs);
- }
- });
- fn.apply(this, args);
- sync = false;
- });
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/every.js b/build/every.js
deleted file mode 100644
index 5cffde8..0000000
--- a/build/every.js
+++ /dev/null
@@ -1,22 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _createTester = require('./internal/createTester');
-
-var _createTester2 = _interopRequireDefault(_createTester);
-
-var _eachOf = require('./eachOf');
-
-var _eachOf2 = _interopRequireDefault(_eachOf);
-
-var _notId = require('./internal/notId');
-
-var _notId2 = _interopRequireDefault(_notId);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _createTester2.default)(_eachOf2.default, _notId2.default, _notId2.default);
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/everyLimit.js b/build/everyLimit.js
deleted file mode 100644
index 1d6ae9c..0000000
--- a/build/everyLimit.js
+++ /dev/null
@@ -1,22 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _createTester = require('./internal/createTester');
-
-var _createTester2 = _interopRequireDefault(_createTester);
-
-var _eachOfLimit = require('./eachOfLimit');
-
-var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
-
-var _notId = require('./internal/notId');
-
-var _notId2 = _interopRequireDefault(_notId);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _createTester2.default)(_eachOfLimit2.default, _notId2.default, _notId2.default);
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/filter.js b/build/filter.js
deleted file mode 100644
index 685821a..0000000
--- a/build/filter.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _filter = require('./internal/filter');
-
-var _filter2 = _interopRequireDefault(_filter);
-
-var _doParallel = require('./internal/doParallel');
-
-var _doParallel2 = _interopRequireDefault(_doParallel);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _doParallel2.default)(_filter2.default);
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/filterLimit.js b/build/filterLimit.js
deleted file mode 100644
index 81d9e39..0000000
--- a/build/filterLimit.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _filter = require('./internal/filter');
-
-var _filter2 = _interopRequireDefault(_filter);
-
-var _doParallelLimit = require('./internal/doParallelLimit');
-
-var _doParallelLimit2 = _interopRequireDefault(_doParallelLimit);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _doParallelLimit2.default)(_filter2.default);
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/filterSeries.js b/build/filterSeries.js
deleted file mode 100644
index 36008b8..0000000
--- a/build/filterSeries.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _filter = require('./internal/filter');
-
-var _filter2 = _interopRequireDefault(_filter);
-
-var _doSeries = require('./internal/doSeries');
-
-var _doSeries2 = _interopRequireDefault(_doSeries);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _doSeries2.default)(_filter2.default);
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/forever.js b/build/forever.js
deleted file mode 100644
index d6864f1..0000000
--- a/build/forever.js
+++ /dev/null
@@ -1,32 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = forever;
-
-var _noop = require('lodash/noop');
-
-var _noop2 = _interopRequireDefault(_noop);
-
-var _onlyOnce = require('./internal/onlyOnce');
-
-var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
-
-var _ensureAsync = require('./ensureAsync');
-
-var _ensureAsync2 = _interopRequireDefault(_ensureAsync);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function forever(fn, cb) {
- var done = (0, _onlyOnce2.default)(cb || _noop2.default);
- var task = (0, _ensureAsync2.default)(fn);
-
- function next(err) {
- if (err) return done(err);
- task(next);
- }
- next();
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/index.js b/build/index.js
deleted file mode 100644
index 62611a9..0000000
--- a/build/index.js
+++ /dev/null
@@ -1,415 +0,0 @@
-'use strict';
-
-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.any = exports.all = exports.whilst = exports.waterfall = exports.until = exports.unmemoize = exports.transform = exports.timesSeries = exports.timesLimit = exports.times = exports.sortBy = exports.someLimit = exports.some = exports.setImmediate = exports.series = exports.seq = exports.retry = exports.rejectSeries = exports.rejectLimit = exports.reject = exports.reduceRight = exports.reduce = exports.queue = exports.priorityQueue = exports.parallelLimit = exports.parallel = exports.nextTick = exports.memoize = exports.mapSeries = exports.mapLimit = exports.map = exports.log = exports.iterator = exports.forever = exports.filterSeries = exports.filterLimit = exports.filter = 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.auto = exports.asyncify = exports.apply = exports.applyEachSeries = exports.applyEach = undefined;
-
-var _applyEach = require('./applyEach');
-
-var _applyEach2 = _interopRequireDefault(_applyEach);
-
-var _applyEachSeries = require('./applyEachSeries');
-
-var _applyEachSeries2 = _interopRequireDefault(_applyEachSeries);
-
-var _apply = require('./apply');
-
-var _apply2 = _interopRequireDefault(_apply);
-
-var _asyncify = require('./asyncify');
-
-var _asyncify2 = _interopRequireDefault(_asyncify);
-
-var _auto = require('./auto');
-
-var _auto2 = _interopRequireDefault(_auto);
-
-var _cargo = require('./cargo');
-
-var _cargo2 = _interopRequireDefault(_cargo);
-
-var _compose = require('./compose');
-
-var _compose2 = _interopRequireDefault(_compose);
-
-var _concat = require('./concat');
-
-var _concat2 = _interopRequireDefault(_concat);
-
-var _concatSeries = require('./concatSeries');
-
-var _concatSeries2 = _interopRequireDefault(_concatSeries);
-
-var _constant = require('./constant');
-
-var _constant2 = _interopRequireDefault(_constant);
-
-var _detect = require('./detect');
-
-var _detect2 = _interopRequireDefault(_detect);
-
-var _detectLimit = require('./detectLimit');
-
-var _detectLimit2 = _interopRequireDefault(_detectLimit);
-
-var _detectSeries = require('./detectSeries');
-
-var _detectSeries2 = _interopRequireDefault(_detectSeries);
-
-var _dir = require('./dir');
-
-var _dir2 = _interopRequireDefault(_dir);
-
-var _doDuring = require('./doDuring');
-
-var _doDuring2 = _interopRequireDefault(_doDuring);
-
-var _doUntil = require('./doUntil');
-
-var _doUntil2 = _interopRequireDefault(_doUntil);
-
-var _doWhilst = require('./doWhilst');
-
-var _doWhilst2 = _interopRequireDefault(_doWhilst);
-
-var _during = require('./during');
-
-var _during2 = _interopRequireDefault(_during);
-
-var _each = require('./each');
-
-var _each2 = _interopRequireDefault(_each);
-
-var _eachLimit = require('./eachLimit');
-
-var _eachLimit2 = _interopRequireDefault(_eachLimit);
-
-var _eachOf = require('./eachOf');
-
-var _eachOf2 = _interopRequireDefault(_eachOf);
-
-var _eachOfLimit = require('./eachOfLimit');
-
-var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
-
-var _eachOfSeries = require('./eachOfSeries');
-
-var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
-
-var _eachSeries = require('./eachSeries');
-
-var _eachSeries2 = _interopRequireDefault(_eachSeries);
-
-var _ensureAsync = require('./ensureAsync');
-
-var _ensureAsync2 = _interopRequireDefault(_ensureAsync);
-
-var _every = require('./every');
-
-var _every2 = _interopRequireDefault(_every);
-
-var _everyLimit = require('./everyLimit');
-
-var _everyLimit2 = _interopRequireDefault(_everyLimit);
-
-var _filter = require('./filter');
-
-var _filter2 = _interopRequireDefault(_filter);
-
-var _filterLimit = require('./filterLimit');
-
-var _filterLimit2 = _interopRequireDefault(_filterLimit);
-
-var _filterSeries = require('./filterSeries');
-
-var _filterSeries2 = _interopRequireDefault(_filterSeries);
-
-var _forever = require('./forever');
-
-var _forever2 = _interopRequireDefault(_forever);
-
-var _iterator = require('./iterator');
-
-var _iterator2 = _interopRequireDefault(_iterator);
-
-var _log = require('./log');
-
-var _log2 = _interopRequireDefault(_log);
-
-var _map = require('./map');
-
-var _map2 = _interopRequireDefault(_map);
-
-var _mapLimit = require('./mapLimit');
-
-var _mapLimit2 = _interopRequireDefault(_mapLimit);
-
-var _mapSeries = require('./mapSeries');
-
-var _mapSeries2 = _interopRequireDefault(_mapSeries);
-
-var _memoize = require('./memoize');
-
-var _memoize2 = _interopRequireDefault(_memoize);
-
-var _nextTick = require('./nextTick');
-
-var _nextTick2 = _interopRequireDefault(_nextTick);
-
-var _parallel = require('./parallel');
-
-var _parallel2 = _interopRequireDefault(_parallel);
-
-var _parallelLimit = require('./parallelLimit');
-
-var _parallelLimit2 = _interopRequireDefault(_parallelLimit);
-
-var _priorityQueue = require('./priorityQueue');
-
-var _priorityQueue2 = _interopRequireDefault(_priorityQueue);
-
-var _queue = require('./queue');
-
-var _queue2 = _interopRequireDefault(_queue);
-
-var _reduce = require('./reduce');
-
-var _reduce2 = _interopRequireDefault(_reduce);
-
-var _reduceRight = require('./reduceRight');
-
-var _reduceRight2 = _interopRequireDefault(_reduceRight);
-
-var _reject = require('./reject');
-
-var _reject2 = _interopRequireDefault(_reject);
-
-var _rejectLimit = require('./rejectLimit');
-
-var _rejectLimit2 = _interopRequireDefault(_rejectLimit);
-
-var _rejectSeries = require('./rejectSeries');
-
-var _rejectSeries2 = _interopRequireDefault(_rejectSeries);
-
-var _retry = require('./retry');
-
-var _retry2 = _interopRequireDefault(_retry);
-
-var _seq = require('./seq');
-
-var _seq2 = _interopRequireDefault(_seq);
-
-var _series = require('./series');
-
-var _series2 = _interopRequireDefault(_series);
-
-var _setImmediate = require('./setImmediate');
-
-var _setImmediate2 = _interopRequireDefault(_setImmediate);
-
-var _some = require('./some');
-
-var _some2 = _interopRequireDefault(_some);
-
-var _someLimit = require('./someLimit');
-
-var _someLimit2 = _interopRequireDefault(_someLimit);
-
-var _sortBy = require('./sortBy');
-
-var _sortBy2 = _interopRequireDefault(_sortBy);
-
-var _times = require('./times');
-
-var _times2 = _interopRequireDefault(_times);
-
-var _timesLimit = require('./timesLimit');
-
-var _timesLimit2 = _interopRequireDefault(_timesLimit);
-
-var _timesSeries = require('./timesSeries');
-
-var _timesSeries2 = _interopRequireDefault(_timesSeries);
-
-var _transform = require('./transform');
-
-var _transform2 = _interopRequireDefault(_transform);
-
-var _unmemoize = require('./unmemoize');
-
-var _unmemoize2 = _interopRequireDefault(_unmemoize);
-
-var _until = require('./until');
-
-var _until2 = _interopRequireDefault(_until);
-
-var _waterfall = require('./waterfall');
-
-var _waterfall2 = _interopRequireDefault(_waterfall);
-
-var _whilst = require('./whilst');
-
-var _whilst2 = _interopRequireDefault(_whilst);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = {
- applyEach: _applyEach2.default,
- applyEachSeries: _applyEachSeries2.default,
- apply: _apply2.default,
- asyncify: _asyncify2.default,
- auto: _auto2.default,
- cargo: _cargo2.default,
- compose: _compose2.default,
- concat: _concat2.default,
- concatSeries: _concatSeries2.default,
- constant: _constant2.default,
- detect: _detect2.default,
- detectLimit: _detectLimit2.default,
- detectSeries: _detectSeries2.default,
- dir: _dir2.default,
- doDuring: _doDuring2.default,
- doUntil: _doUntil2.default,
- doWhilst: _doWhilst2.default,
- during: _during2.default,
- each: _each2.default,
- eachLimit: _eachLimit2.default,
- eachOf: _eachOf2.default,
- eachOfLimit: _eachOfLimit2.default,
- eachOfSeries: _eachOfSeries2.default,
- eachSeries: _eachSeries2.default,
- ensureAsync: _ensureAsync2.default,
- every: _every2.default,
- everyLimit: _everyLimit2.default,
- filter: _filter2.default,
- filterLimit: _filterLimit2.default,
- filterSeries: _filterSeries2.default,
- forever: _forever2.default,
- iterator: _iterator2.default,
- log: _log2.default,
- map: _map2.default,
- mapLimit: _mapLimit2.default,
- mapSeries: _mapSeries2.default,
- memoize: _memoize2.default,
- nextTick: _nextTick2.default,
- parallel: _parallel2.default,
- parallelLimit: _parallelLimit2.default,
- priorityQueue: _priorityQueue2.default,
- queue: _queue2.default,
- reduce: _reduce2.default,
- reduceRight: _reduceRight2.default,
- reject: _reject2.default,
- rejectLimit: _rejectLimit2.default,
- rejectSeries: _rejectSeries2.default,
- retry: _retry2.default,
- seq: _seq2.default,
- series: _series2.default,
- setImmediate: _setImmediate2.default,
- some: _some2.default,
- someLimit: _someLimit2.default,
- sortBy: _sortBy2.default,
- times: _times2.default,
- timesLimit: _timesLimit2.default,
- timesSeries: _timesSeries2.default,
- transform: _transform2.default,
- unmemoize: _unmemoize2.default,
- until: _until2.default,
- waterfall: _waterfall2.default,
- whilst: _whilst2.default,
-
- // aliases
- all: _every2.default,
- any: _some2.default,
- forEach: _each2.default,
- forEachSeries: _eachSeries2.default,
- forEachLimit: _eachLimit2.default,
- forEachOf: _eachOf2.default,
- forEachOfSeries: _eachOfSeries2.default,
- forEachOfLimit: _eachOfLimit2.default,
- inject: _reduce2.default,
- foldl: _reduce2.default,
- foldr: _reduceRight2.default,
- select: _filter2.default,
- selectLimit: _filterLimit2.default,
- selectSeries: _filterSeries2.default,
- wrapSync: _asyncify2.default
-};
-exports.applyEach = _applyEach2.default;
-exports.applyEachSeries = _applyEachSeries2.default;
-exports.apply = _apply2.default;
-exports.asyncify = _asyncify2.default;
-exports.auto = _auto2.default;
-exports.cargo = _cargo2.default;
-exports.compose = _compose2.default;
-exports.concat = _concat2.default;
-exports.concatSeries = _concatSeries2.default;
-exports.constant = _constant2.default;
-exports.detect = _detect2.default;
-exports.detectLimit = _detectLimit2.default;
-exports.detectSeries = _detectSeries2.default;
-exports.dir = _dir2.default;
-exports.doDuring = _doDuring2.default;
-exports.doUntil = _doUntil2.default;
-exports.doWhilst = _doWhilst2.default;
-exports.during = _during2.default;
-exports.each = _each2.default;
-exports.eachLimit = _eachLimit2.default;
-exports.eachOf = _eachOf2.default;
-exports.eachOfLimit = _eachOfLimit2.default;
-exports.eachOfSeries = _eachOfSeries2.default;
-exports.eachSeries = _eachSeries2.default;
-exports.ensureAsync = _ensureAsync2.default;
-exports.every = _every2.default;
-exports.everyLimit = _everyLimit2.default;
-exports.filter = _filter2.default;
-exports.filterLimit = _filterLimit2.default;
-exports.filterSeries = _filterSeries2.default;
-exports.forever = _forever2.default;
-exports.iterator = _iterator2.default;
-exports.log = _log2.default;
-exports.map = _map2.default;
-exports.mapLimit = _mapLimit2.default;
-exports.mapSeries = _mapSeries2.default;
-exports.memoize = _memoize2.default;
-exports.nextTick = _nextTick2.default;
-exports.parallel = _parallel2.default;
-exports.parallelLimit = _parallelLimit2.default;
-exports.priorityQueue = _priorityQueue2.default;
-exports.queue = _queue2.default;
-exports.reduce = _reduce2.default;
-exports.reduceRight = _reduceRight2.default;
-exports.reject = _reject2.default;
-exports.rejectLimit = _rejectLimit2.default;
-exports.rejectSeries = _rejectSeries2.default;
-exports.retry = _retry2.default;
-exports.seq = _seq2.default;
-exports.series = _series2.default;
-exports.setImmediate = _setImmediate2.default;
-exports.some = _some2.default;
-exports.someLimit = _someLimit2.default;
-exports.sortBy = _sortBy2.default;
-exports.times = _times2.default;
-exports.timesLimit = _timesLimit2.default;
-exports.timesSeries = _timesSeries2.default;
-exports.transform = _transform2.default;
-exports.unmemoize = _unmemoize2.default;
-exports.until = _until2.default;
-exports.waterfall = _waterfall2.default;
-exports.whilst = _whilst2.default;
-exports.all = _every2.default;
-exports.any = _some2.default;
-exports.forEach = _each2.default;
-exports.forEachSeries = _eachSeries2.default;
-exports.forEachLimit = _eachLimit2.default;
-exports.forEachOf = _eachOf2.default;
-exports.forEachOfSeries = _eachOfSeries2.default;
-exports.forEachOfLimit = _eachOfLimit2.default;
-exports.inject = _reduce2.default;
-exports.foldl = _reduce2.default;
-exports.foldr = _reduceRight2.default;
-exports.select = _filter2.default;
-exports.selectLimit = _filterLimit2.default;
-exports.selectSeries = _filterSeries2.default;
-exports.wrapSync = _asyncify2.default; \ No newline at end of file
diff --git a/build/internal/applyEach.js b/build/internal/applyEach.js
deleted file mode 100644
index a2534e0..0000000
--- a/build/internal/applyEach.js
+++ /dev/null
@@ -1,30 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = applyEach;
-
-var _rest = require('lodash/rest');
-
-var _rest2 = _interopRequireDefault(_rest);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function applyEach(eachfn) {
- return (0, _rest2.default)(function (fns, args) {
- var go = (0, _rest2.default)(function (args) {
- var that = this;
- var callback = args.pop();
- return eachfn(fns, function (fn, _, cb) {
- fn.apply(that, args.concat([cb]));
- }, callback);
- });
- if (args.length) {
- return go.apply(this, args);
- } else {
- return go;
- }
- });
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/internal/concat.js b/build/internal/concat.js
deleted file mode 100644
index 4fd7b26..0000000
--- a/build/internal/concat.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = concat;
-function concat(eachfn, arr, fn, callback) {
- var result = [];
- eachfn(arr, function (x, index, cb) {
- fn(x, function (err, y) {
- result = result.concat(y || []);
- cb(err);
- });
- }, function (err) {
- callback(err, result);
- });
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/internal/consoleFunc.js b/build/internal/consoleFunc.js
deleted file mode 100644
index f7befa8..0000000
--- a/build/internal/consoleFunc.js
+++ /dev/null
@@ -1,35 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = consoleFunc;
-
-var _arrayEach = require('lodash/_arrayEach');
-
-var _arrayEach2 = _interopRequireDefault(_arrayEach);
-
-var _rest = require('lodash/rest');
-
-var _rest2 = _interopRequireDefault(_rest);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function consoleFunc(name) {
- return (0, _rest2.default)(function (fn, args) {
- fn.apply(null, args.concat([(0, _rest2.default)(function (err, args) {
- if (typeof console === 'object') {
- if (err) {
- if (console.error) {
- console.error(err);
- }
- } else if (console[name]) {
- (0, _arrayEach2.default)(args, function (x) {
- console[name](x);
- });
- }
- }
- })]));
- });
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/internal/createTester.js b/build/internal/createTester.js
deleted file mode 100644
index 1f225a9..0000000
--- a/build/internal/createTester.js
+++ /dev/null
@@ -1,42 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = _createTester;
-function _createTester(eachfn, check, getResult) {
- return function (arr, limit, iterator, cb) {
- function done(err) {
- if (cb) {
- if (err) {
- cb(err);
- } else {
- cb(null, getResult(false, void 0));
- }
- }
- }
- function iteratee(x, _, callback) {
- if (!cb) return callback();
- iterator(x, function (err, v) {
- if (cb) {
- if (err) {
- cb(err);
- cb = iterator = false;
- } else if (check(v)) {
- cb(null, getResult(true, x));
- cb = iterator = false;
- }
- }
- callback();
- });
- }
- if (arguments.length > 3) {
- eachfn(arr, limit, iteratee, done);
- } else {
- cb = iterator;
- iterator = limit;
- eachfn(arr, iteratee, done);
- }
- };
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/internal/doParallel.js b/build/internal/doParallel.js
deleted file mode 100644
index a96a142..0000000
--- a/build/internal/doParallel.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = doParallel;
-
-var _eachOf = require('../eachOf');
-
-var _eachOf2 = _interopRequireDefault(_eachOf);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function doParallel(fn) {
- return function (obj, iterator, callback) {
- return fn(_eachOf2.default, obj, iterator, callback);
- };
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/internal/doParallelLimit.js b/build/internal/doParallelLimit.js
deleted file mode 100644
index 9472fd0..0000000
--- a/build/internal/doParallelLimit.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = doParallelLimit;
-
-var _eachOfLimit = require('./eachOfLimit');
-
-var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function doParallelLimit(fn) {
- return function (obj, limit, iterator, callback) {
- return fn((0, _eachOfLimit2.default)(limit), obj, iterator, callback);
- };
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/internal/doSeries.js b/build/internal/doSeries.js
deleted file mode 100644
index f17cd0d..0000000
--- a/build/internal/doSeries.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = doSeries;
-
-var _eachOfSeries = require('../eachOfSeries');
-
-var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function doSeries(fn) {
- return function (obj, iterator, callback) {
- return fn(_eachOfSeries2.default, obj, iterator, callback);
- };
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/internal/eachOfLimit.js b/build/internal/eachOfLimit.js
deleted file mode 100644
index 314b224..0000000
--- a/build/internal/eachOfLimit.js
+++ /dev/null
@@ -1,66 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = _eachOfLimit;
-
-var _noop = require('lodash/noop');
-
-var _noop2 = _interopRequireDefault(_noop);
-
-var _once = require('lodash/once');
-
-var _once2 = _interopRequireDefault(_once);
-
-var _keyIterator = require('./keyIterator');
-
-var _keyIterator2 = _interopRequireDefault(_keyIterator);
-
-var _onlyOnce = require('./onlyOnce');
-
-var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _eachOfLimit(limit) {
- return function (obj, iterator, callback) {
- callback = (0, _once2.default)(callback || _noop2.default);
- obj = obj || [];
- var nextKey = (0, _keyIterator2.default)(obj);
- if (limit <= 0) {
- return callback(null);
- }
- var done = false;
- var running = 0;
- var errored = false;
-
- (function replenish() {
- if (done && running <= 0) {
- return callback(null);
- }
-
- while (running < limit && !errored) {
- var key = nextKey();
- if (key === null) {
- done = true;
- if (running <= 0) {
- callback(null);
- }
- return;
- }
- running += 1;
- iterator(obj[key], key, (0, _onlyOnce2.default)(function (err) {
- running -= 1;
- if (err) {
- callback(err);
- errored = true;
- } else {
- replenish();
- }
- }));
- }
- })();
- };
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/internal/filter.js b/build/internal/filter.js
deleted file mode 100644
index 1b8a911..0000000
--- a/build/internal/filter.js
+++ /dev/null
@@ -1,41 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = _filter;
-
-var _arrayMap = require('lodash/_arrayMap');
-
-var _arrayMap2 = _interopRequireDefault(_arrayMap);
-
-var _baseProperty = require('lodash/_baseProperty');
-
-var _baseProperty2 = _interopRequireDefault(_baseProperty);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _filter(eachfn, arr, iterator, callback) {
- var results = [];
- eachfn(arr, function (x, index, callback) {
- iterator(x, function (err, v) {
- if (err) {
- callback(err);
- } else {
- if (v) {
- results.push({ index: index, value: x });
- }
- callback();
- }
- });
- }, function (err) {
- if (err) {
- callback(err);
- } else {
- callback(null, (0, _arrayMap2.default)(results.sort(function (a, b) {
- return a.index - b.index;
- }), (0, _baseProperty2.default)('value')));
- }
- });
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/internal/findGetResult.js b/build/internal/findGetResult.js
deleted file mode 100644
index 46d0140..0000000
--- a/build/internal/findGetResult.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = _findGetResult;
-function _findGetResult(v, x) {
- return x;
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/internal/keyIterator.js b/build/internal/keyIterator.js
deleted file mode 100644
index 3ed3ab1..0000000
--- a/build/internal/keyIterator.js
+++ /dev/null
@@ -1,36 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = keyIterator;
-
-var _isArrayLike = require('lodash/isArrayLike');
-
-var _isArrayLike2 = _interopRequireDefault(_isArrayLike);
-
-var _keys = require('lodash/keys');
-
-var _keys2 = _interopRequireDefault(_keys);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function keyIterator(coll) {
- var i = -1;
- var len;
- if ((0, _isArrayLike2.default)(coll)) {
- len = coll.length;
- return function next() {
- i++;
- return i < len ? i : null;
- };
- } else {
- var okeys = (0, _keys2.default)(coll);
- len = okeys.length;
- return function next() {
- i++;
- return i < len ? okeys[i] : null;
- };
- }
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/internal/map.js b/build/internal/map.js
deleted file mode 100644
index ac47206..0000000
--- a/build/internal/map.js
+++ /dev/null
@@ -1,35 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = _asyncMap;
-
-var _isArrayLike = require('lodash/isArrayLike');
-
-var _isArrayLike2 = _interopRequireDefault(_isArrayLike);
-
-var _noop = require('lodash/noop');
-
-var _noop2 = _interopRequireDefault(_noop);
-
-var _once = require('lodash/once');
-
-var _once2 = _interopRequireDefault(_once);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _asyncMap(eachfn, arr, iterator, callback) {
- callback = (0, _once2.default)(callback || _noop2.default);
- arr = arr || [];
- var results = (0, _isArrayLike2.default)(arr) ? [] : {};
- eachfn(arr, function (value, index, callback) {
- iterator(value, function (err, v) {
- results[index] = v;
- callback(err);
- });
- }, function (err) {
- callback(err, results);
- });
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/internal/notId.js b/build/internal/notId.js
deleted file mode 100644
index 432ab12..0000000
--- a/build/internal/notId.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = notId;
-function notId(v) {
- return !v;
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/internal/onlyOnce.js b/build/internal/onlyOnce.js
deleted file mode 100644
index 25e6779..0000000
--- a/build/internal/onlyOnce.js
+++ /dev/null
@@ -1,14 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = onlyOnce;
-function onlyOnce(fn) {
- return function () {
- if (fn === null) throw new Error("Callback was already called.");
- fn.apply(this, arguments);
- fn = null;
- };
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/internal/parallel.js b/build/internal/parallel.js
deleted file mode 100644
index f04888c..0000000
--- a/build/internal/parallel.js
+++ /dev/null
@@ -1,38 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = _parallel;
-
-var _noop = require('lodash/noop');
-
-var _noop2 = _interopRequireDefault(_noop);
-
-var _isArrayLike = require('lodash/isArrayLike');
-
-var _isArrayLike2 = _interopRequireDefault(_isArrayLike);
-
-var _rest = require('lodash/rest');
-
-var _rest2 = _interopRequireDefault(_rest);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _parallel(eachfn, tasks, callback) {
- callback = callback || _noop2.default;
- var results = (0, _isArrayLike2.default)(tasks) ? [] : {};
-
- eachfn(tasks, function (task, key, callback) {
- task((0, _rest2.default)(function (err, args) {
- if (args.length <= 1) {
- args = args[0];
- }
- results[key] = args;
- callback(err);
- }));
- }, function (err) {
- callback(err, results);
- });
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/internal/queue.js b/build/internal/queue.js
deleted file mode 100644
index 72fc685..0000000
--- a/build/internal/queue.js
+++ /dev/null
@@ -1,166 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = queue;
-
-var _arrayEach = require('lodash/_arrayEach');
-
-var _arrayEach2 = _interopRequireDefault(_arrayEach);
-
-var _arrayMap = require('lodash/_arrayMap');
-
-var _arrayMap2 = _interopRequireDefault(_arrayMap);
-
-var _isArray = require('lodash/isArray');
-
-var _isArray2 = _interopRequireDefault(_isArray);
-
-var _noop = require('lodash/noop');
-
-var _noop2 = _interopRequireDefault(_noop);
-
-var _baseProperty = require('lodash/_baseProperty');
-
-var _baseProperty2 = _interopRequireDefault(_baseProperty);
-
-var _onlyOnce = require('./onlyOnce');
-
-var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
-
-var _setImmediate = require('./setImmediate');
-
-var _setImmediate2 = _interopRequireDefault(_setImmediate);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function queue(worker, concurrency, payload) {
- if (concurrency == null) {
- concurrency = 1;
- } else if (concurrency === 0) {
- throw new Error('Concurrency must not be zero');
- }
- function _insert(q, data, pos, callback) {
- if (callback != null && typeof callback !== 'function') {
- throw new Error('task callback must be a function');
- }
- q.started = true;
- if (!(0, _isArray2.default)(data)) {
- data = [data];
- }
- if (data.length === 0 && q.idle()) {
- // call drain immediately if there are no tasks
- return (0, _setImmediate2.default)(function () {
- q.drain();
- });
- }
- (0, _arrayEach2.default)(data, function (task) {
- var item = {
- data: task,
- callback: callback || _noop2.default
- };
-
- if (pos) {
- q.tasks.unshift(item);
- } else {
- q.tasks.push(item);
- }
-
- if (q.tasks.length === q.concurrency) {
- q.saturated();
- }
- });
- (0, _setImmediate2.default)(q.process);
- }
- function _next(q, tasks) {
- return function () {
- workers -= 1;
-
- var removed = false;
- var args = arguments;
- (0, _arrayEach2.default)(tasks, function (task) {
- (0, _arrayEach2.default)(workersList, function (worker, index) {
- if (worker === task && !removed) {
- workersList.splice(index, 1);
- removed = true;
- }
- });
-
- task.callback.apply(task, args);
- });
- if (q.tasks.length + workers === 0) {
- q.drain();
- }
- q.process();
- };
- }
-
- var workers = 0;
- var workersList = [];
- var q = {
- tasks: [],
- concurrency: concurrency,
- payload: payload,
- saturated: _noop2.default,
- empty: _noop2.default,
- drain: _noop2.default,
- started: false,
- paused: false,
- push: function (data, callback) {
- _insert(q, data, false, callback);
- },
- kill: function () {
- q.drain = _noop2.default;
- q.tasks = [];
- },
- unshift: function (data, callback) {
- _insert(q, data, true, callback);
- },
- process: function () {
- while (!q.paused && workers < q.concurrency && q.tasks.length) {
-
- var tasks = q.payload ? q.tasks.splice(0, q.payload) : q.tasks.splice(0, q.tasks.length);
-
- var data = (0, _arrayMap2.default)(tasks, (0, _baseProperty2.default)('data'));
-
- if (q.tasks.length === 0) {
- q.empty();
- }
- workers += 1;
- workersList.push(tasks[0]);
- var cb = (0, _onlyOnce2.default)(_next(q, tasks));
- worker(data, cb);
- }
- },
- length: function () {
- return q.tasks.length;
- },
- running: function () {
- return workers;
- },
- workersList: function () {
- return workersList;
- },
- idle: function () {
- return q.tasks.length + workers === 0;
- },
- pause: function () {
- q.paused = true;
- },
- resume: function () {
- if (q.paused === false) {
- return;
- }
- q.paused = false;
- var resumeCount = Math.min(q.concurrency, q.tasks.length);
- // Need to call q.process once per concurrent
- // worker to preserve full concurrency after pause
- for (var w = 1; w <= resumeCount; w++) {
- (0, _setImmediate2.default)(q.process);
- }
- }
- };
- return q;
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/internal/reject.js b/build/internal/reject.js
deleted file mode 100644
index 1aba930..0000000
--- a/build/internal/reject.js
+++ /dev/null
@@ -1,25 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = reject;
-
-var _filter = require('./filter');
-
-var _filter2 = _interopRequireDefault(_filter);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function reject(eachfn, arr, iterator, callback) {
- (0, _filter2.default)(eachfn, arr, function (value, cb) {
- iterator(value, function (err, v) {
- if (err) {
- cb(err);
- } else {
- cb(null, !v);
- }
- });
- }, callback);
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/internal/setImmediate.js b/build/internal/setImmediate.js
deleted file mode 100644
index 8157f22..0000000
--- a/build/internal/setImmediate.js
+++ /dev/null
@@ -1,23 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-var _setImmediate = typeof setImmediate === 'function' && setImmediate;
-
-var _delay;
-if (_setImmediate) {
- _delay = function (fn) {
- // not a direct alias for IE10 compatibility
- _setImmediate(fn);
- };
-} else if (typeof process === 'object' && typeof process.nextTick === 'function') {
- _delay = process.nextTick;
-} else {
- _delay = function (fn) {
- setTimeout(fn, 0);
- };
-}
-
-exports.default = _delay;
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/internal/withoutIndex.js b/build/internal/withoutIndex.js
deleted file mode 100644
index 7bc3771..0000000
--- a/build/internal/withoutIndex.js
+++ /dev/null
@@ -1,12 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = _withoutIndex;
-function _withoutIndex(iterator) {
- return function (value, index, callback) {
- return iterator(value, callback);
- };
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/iterator.js b/build/iterator.js
deleted file mode 100644
index 98e3608..0000000
--- a/build/iterator.js
+++ /dev/null
@@ -1,23 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-exports.default = function (tasks) {
- function makeCallback(index) {
- function fn() {
- if (tasks.length) {
- tasks[index].apply(null, arguments);
- }
- return fn.next();
- }
- fn.next = function () {
- return index < tasks.length - 1 ? makeCallback(index + 1) : null;
- };
- return fn;
- }
- return makeCallback(0);
-};
-
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/log.js b/build/log.js
deleted file mode 100644
index b800154..0000000
--- a/build/log.js
+++ /dev/null
@@ -1,14 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _consoleFunc = require('./internal/consoleFunc');
-
-var _consoleFunc2 = _interopRequireDefault(_consoleFunc);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _consoleFunc2.default)('log');
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/map.js b/build/map.js
deleted file mode 100644
index 0c00a7e..0000000
--- a/build/map.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _doParallel = require('./internal/doParallel');
-
-var _doParallel2 = _interopRequireDefault(_doParallel);
-
-var _map = require('./internal/map');
-
-var _map2 = _interopRequireDefault(_map);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _doParallel2.default)(_map2.default);
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/mapLimit.js b/build/mapLimit.js
deleted file mode 100644
index 48da689..0000000
--- a/build/mapLimit.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _doParallelLimit = require('./internal/doParallelLimit');
-
-var _doParallelLimit2 = _interopRequireDefault(_doParallelLimit);
-
-var _map = require('./internal/map');
-
-var _map2 = _interopRequireDefault(_map);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _doParallelLimit2.default)(_map2.default);
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/mapSeries.js b/build/mapSeries.js
deleted file mode 100644
index be22494..0000000
--- a/build/mapSeries.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _map = require('./internal/map');
-
-var _map2 = _interopRequireDefault(_map);
-
-var _doSeries = require('./internal/doSeries');
-
-var _doSeries2 = _interopRequireDefault(_doSeries);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _doSeries2.default)(_map2.default);
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/memoize.js b/build/memoize.js
deleted file mode 100644
index 38b12a4..0000000
--- a/build/memoize.js
+++ /dev/null
@@ -1,55 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = memoize;
-
-var _identity = require('lodash/identity');
-
-var _identity2 = _interopRequireDefault(_identity);
-
-var _rest = require('lodash/rest');
-
-var _rest2 = _interopRequireDefault(_rest);
-
-var _has = require('lodash/has');
-
-var _has2 = _interopRequireDefault(_has);
-
-var _setImmediate = require('./internal/setImmediate');
-
-var _setImmediate2 = _interopRequireDefault(_setImmediate);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function memoize(fn, hasher) {
- var memo = Object.create(null);
- var queues = Object.create(null);
- hasher = hasher || _identity2.default;
- var memoized = (0, _rest2.default)(function memoized(args) {
- var callback = args.pop();
- var key = hasher.apply(null, args);
- if ((0, _has2.default)(memo, key)) {
- (0, _setImmediate2.default)(function () {
- callback.apply(null, memo[key]);
- });
- } else if ((0, _has2.default)(queues, key)) {
- queues[key].push(callback);
- } else {
- queues[key] = [callback];
- fn.apply(null, args.concat([(0, _rest2.default)(function (args) {
- 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;
- memoized.unmemoized = fn;
- return memoized;
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/nextTick.js b/build/nextTick.js
deleted file mode 100644
index feba4a8..0000000
--- a/build/nextTick.js
+++ /dev/null
@@ -1,16 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _setImmediate = require('./internal/setImmediate');
-
-var _setImmediate2 = _interopRequireDefault(_setImmediate);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-var nexTick = typeof process === 'object' && typeof process.nextTick === 'function' ? process.nextTick : _setImmediate2.default;
-
-exports.default = nexTick;
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/package.json b/build/package.json
deleted file mode 100644
index f870557..0000000
--- a/build/package.json
+++ /dev/null
@@ -1,94 +0,0 @@
-{
- "name": "async",
- "description": "Higher-order functions and common patterns for asynchronous code",
- "version": "2.0.0-alpha",
- "main": "dist/async.js",
- "author": "Caolan McMahon",
- "repository": {
- "type": "git",
- "url": "https://github.com/caolan/async.git"
- },
- "bugs": {
- "url": "https://github.com/caolan/async/issues"
- },
- "keywords": [
- "async",
- "callback",
- "module",
- "utility"
- ],
- "dependencies": {
- "lodash": "^4.3.0"
- },
- "devDependencies": {
- "babel-cli": "^6.3.17",
- "babel-core": "^6.3.26",
- "babel-plugin-add-module-exports": "~0.1.2",
- "babel-plugin-transform-es2015-modules-commonjs": "^6.3.16",
- "babel-preset-es2015": "^6.3.13",
- "babelify": "^7.2.0",
- "benchmark": "bestiejs/benchmark.js",
- "bluebird": "^2.9.32",
- "chai": "^3.1.0",
- "coveralls": "^2.11.2",
- "es6-promise": "^2.3.0",
- "fs-extra": "^0.26.3",
- "gulp": "~3.9.0",
- "jscs": "^1.13.1",
- "jshint": "~2.8.0",
- "karma": "^0.13.2",
- "karma-browserify": "^4.2.1",
- "karma-firefox-launcher": "^0.1.6",
- "karma-mocha": "^0.2.0",
- "karma-mocha-reporter": "^1.0.2",
- "mocha": "^2.2.5",
- "native-promise-only": "^0.8.0-a",
- "nodeunit": ">0.0.0",
- "nyc": "^2.1.0",
- "recursive-readdir": "^1.3.0",
- "rimraf": "^2.5.0",
- "rollup": "^0.25.0",
- "rollup-plugin-npm": "~1.3.0",
- "rsvp": "^3.0.18",
- "semver": "^4.3.6",
- "uglify-js": "~2.4.0",
- "vinyl-buffer": "~1.0.0",
- "vinyl-source-stream": "~1.1.0",
- "yargs": "~3.9.1"
- },
- "scripts": {
- "coverage": "nyc npm test && nyc report",
- "coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls",
- "lint": "jshint lib/ test/ mocha_test/ perf/memory.js perf/suites.js perf/benchmark.js support/ gulpfile.js karma.conf.js && jscs lib/ test/ mocha_test/ perf/memory.js perf/suites.js perf/benchmark.js support/ gulpfile.js karma.conf.js",
- "mocha-browser-test": "karma start",
- "mocha-node-test": "mocha mocha_test/ --compilers js:babel-core/register",
- "mocha-test": "npm run mocha-node-test && npm run mocha-browser-test",
- "nodeunit-test": "nodeunit test/test-async.js",
- "test": "npm run-script lint && npm run nodeunit-test && npm run mocha-test"
- },
- "license": "MIT",
- "jam": {
- "main": "dist/async.js",
- "include": [
- "dist/async.js",
- "README.md",
- "LICENSE"
- ],
- "categories": [
- "Utilities"
- ]
- },
- "spm": {
- "main": "dist/async.js"
- },
- "volo": {
- "main": "dist/async.js",
- "ignore": [
- "**/.*",
- "node_modules",
- "bower_components",
- "test",
- "tests"
- ]
- }
-} \ No newline at end of file
diff --git a/build/parallel.js b/build/parallel.js
deleted file mode 100644
index 5867802..0000000
--- a/build/parallel.js
+++ /dev/null
@@ -1,21 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = parallel;
-
-var _parallel2 = require('./internal/parallel');
-
-var _parallel3 = _interopRequireDefault(_parallel2);
-
-var _eachOf = require('./eachOf');
-
-var _eachOf2 = _interopRequireDefault(_eachOf);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function parallel(tasks, cb) {
- return (0, _parallel3.default)(_eachOf2.default, tasks, cb);
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/parallelLimit.js b/build/parallelLimit.js
deleted file mode 100644
index 6c0da55..0000000
--- a/build/parallelLimit.js
+++ /dev/null
@@ -1,21 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = parallelLimit;
-
-var _eachOfLimit = require('./internal/eachOfLimit');
-
-var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
-
-var _parallel = require('./internal/parallel');
-
-var _parallel2 = _interopRequireDefault(_parallel);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function parallelLimit(tasks, limit, cb) {
- return (0, _parallel2.default)((0, _eachOfLimit2.default)(limit), tasks, cb);
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/priorityQueue.js b/build/priorityQueue.js
deleted file mode 100644
index 8f02f16..0000000
--- a/build/priorityQueue.js
+++ /dev/null
@@ -1,92 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-exports.default = function (worker, concurrency) {
- function _compareTasks(a, b) {
- return a.priority - b.priority;
- }
-
- function _binarySearch(sequence, item, compare) {
- var beg = -1,
- end = sequence.length - 1;
- while (beg < end) {
- var mid = beg + (end - beg + 1 >>> 1);
- if (compare(item, sequence[mid]) >= 0) {
- beg = mid;
- } else {
- end = mid - 1;
- }
- }
- return beg;
- }
-
- function _insert(q, data, priority, callback) {
- if (callback != null && typeof callback !== 'function') {
- throw new Error('task callback must be a function');
- }
- q.started = true;
- if (!(0, _isArray2.default)(data)) {
- data = [data];
- }
- if (data.length === 0) {
- // call drain immediately if there are no tasks
- return (0, _setImmediate2.default)(function () {
- q.drain();
- });
- }
- (0, _arrayEach2.default)(data, function (task) {
- var item = {
- data: task,
- priority: priority,
- callback: typeof callback === 'function' ? callback : _noop2.default
- };
-
- q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item);
-
- if (q.tasks.length === q.concurrency) {
- q.saturated();
- }
- (0, _setImmediate2.default)(q.process);
- });
- }
-
- // Start with a normal queue
- var q = (0, _queue2.default)(worker, concurrency);
-
- // Override push to accept second parameter representing priority
- q.push = function (data, priority, callback) {
- _insert(q, data, priority, callback);
- };
-
- // Remove unshift function
- delete q.unshift;
-
- return q;
-};
-
-var _arrayEach = require('lodash/_arrayEach');
-
-var _arrayEach2 = _interopRequireDefault(_arrayEach);
-
-var _isArray = require('lodash/isArray');
-
-var _isArray2 = _interopRequireDefault(_isArray);
-
-var _noop = require('lodash/noop');
-
-var _noop2 = _interopRequireDefault(_noop);
-
-var _setImmediate = require('./setImmediate');
-
-var _setImmediate2 = _interopRequireDefault(_setImmediate);
-
-var _queue = require('./queue');
-
-var _queue2 = _interopRequireDefault(_queue);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/queue.js b/build/queue.js
deleted file mode 100644
index 4631eca..0000000
--- a/build/queue.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-exports.default = function (worker, concurrency) {
- return (0, _queue2.default)(function (items, cb) {
- worker(items[0], cb);
- }, concurrency, 1);
-};
-
-var _queue = require('./internal/queue');
-
-var _queue2 = _interopRequireDefault(_queue);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/reduce.js b/build/reduce.js
deleted file mode 100644
index f72e194..0000000
--- a/build/reduce.js
+++ /dev/null
@@ -1,24 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = reduce;
-
-var _eachOfSeries = require('./eachOfSeries');
-
-var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function reduce(arr, memo, iterator, cb) {
- (0, _eachOfSeries2.default)(arr, function (x, i, cb) {
- iterator(memo, x, function (err, v) {
- memo = v;
- cb(err);
- });
- }, function (err) {
- cb(err, memo);
- });
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/reduceRight.js b/build/reduceRight.js
deleted file mode 100644
index cbebe8b..0000000
--- a/build/reduceRight.js
+++ /dev/null
@@ -1,20 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = reduceRight;
-
-var _reduce = require('./reduce');
-
-var _reduce2 = _interopRequireDefault(_reduce);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-var slice = Array.prototype.slice;
-
-function reduceRight(arr, memo, iterator, cb) {
- var reversed = slice.call(arr).reverse();
- (0, _reduce2.default)(reversed, memo, iterator, cb);
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/reject.js b/build/reject.js
deleted file mode 100644
index 2ed180c..0000000
--- a/build/reject.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _reject = require('./internal/reject');
-
-var _reject2 = _interopRequireDefault(_reject);
-
-var _doParallel = require('./internal/doParallel');
-
-var _doParallel2 = _interopRequireDefault(_doParallel);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _doParallel2.default)(_reject2.default);
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/rejectLimit.js b/build/rejectLimit.js
deleted file mode 100644
index cc98c34..0000000
--- a/build/rejectLimit.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _reject = require('./internal/reject');
-
-var _reject2 = _interopRequireDefault(_reject);
-
-var _doParallelLimit = require('./internal/doParallelLimit');
-
-var _doParallelLimit2 = _interopRequireDefault(_doParallelLimit);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _doParallelLimit2.default)(_reject2.default);
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/rejectSeries.js b/build/rejectSeries.js
deleted file mode 100644
index 572de9f..0000000
--- a/build/rejectSeries.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _reject = require('./internal/reject');
-
-var _reject2 = _interopRequireDefault(_reject);
-
-var _doSeries = require('./internal/doSeries');
-
-var _doSeries2 = _interopRequireDefault(_doSeries);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _doSeries2.default)(_reject2.default);
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/retry.js b/build/retry.js
deleted file mode 100644
index a2d81cb..0000000
--- a/build/retry.js
+++ /dev/null
@@ -1,87 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = retry;
-
-var _series = require('./series');
-
-var _series2 = _interopRequireDefault(_series);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function retry(times, task, callback) {
- var DEFAULT_TIMES = 5;
- var DEFAULT_INTERVAL = 0;
-
- var attempts = [];
-
- var opts = {
- times: DEFAULT_TIMES,
- interval: DEFAULT_INTERVAL
- };
-
- function parseTimes(acc, t) {
- if (typeof t === 'number') {
- acc.times = parseInt(t, 10) || DEFAULT_TIMES;
- } else if (typeof t === 'object') {
- acc.times = parseInt(t.times, 10) || DEFAULT_TIMES;
- acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL;
- } else {
- throw new Error('Unsupported argument type for \'times\': ' + typeof t);
- }
- }
-
- var length = arguments.length;
- if (length < 1 || length > 3) {
- throw new Error('Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)');
- } else if (length <= 2 && typeof times === 'function') {
- callback = task;
- task = times;
- }
- if (typeof times !== 'function') {
- parseTimes(opts, times);
- }
- opts.callback = callback;
- opts.task = task;
-
- function wrappedTask(wrappedCallback, wrappedResults) {
- function retryAttempt(task, finalAttempt) {
- return function (seriesCallback) {
- task(function (err, result) {
- seriesCallback(!err || finalAttempt, {
- err: err,
- result: result
- });
- }, wrappedResults);
- };
- }
-
- function retryInterval(interval) {
- return function (seriesCallback) {
- setTimeout(function () {
- seriesCallback(null);
- }, interval);
- };
- }
-
- while (opts.times) {
-
- var finalAttempt = !(opts.times -= 1);
- attempts.push(retryAttempt(opts.task, finalAttempt));
- if (!finalAttempt && opts.interval > 0) {
- attempts.push(retryInterval(opts.interval));
- }
- }
-
- (0, _series2.default)(attempts, function (done, data) {
- data = data[data.length - 1];
- (wrappedCallback || opts.callback)(data.err, data.result);
- });
- }
-
- // If a callback is passed, run this as a controll flow
- return opts.callback ? wrappedTask() : wrappedTask;
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/seq.js b/build/seq.js
deleted file mode 100644
index ee316c4..0000000
--- a/build/seq.js
+++ /dev/null
@@ -1,43 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = seq;
-
-var _noop = require('lodash/noop');
-
-var _noop2 = _interopRequireDefault(_noop);
-
-var _rest = require('lodash/rest');
-
-var _rest2 = _interopRequireDefault(_rest);
-
-var _reduce = require('./reduce');
-
-var _reduce2 = _interopRequireDefault(_reduce);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function seq() /* functions... */{
- var fns = arguments;
- return (0, _rest2.default)(function (args) {
- var that = this;
-
- var cb = args[args.length - 1];
- if (typeof cb == 'function') {
- args.pop();
- } else {
- cb = _noop2.default;
- }
-
- (0, _reduce2.default)(fns, args, function (newargs, fn, cb) {
- fn.apply(that, newargs.concat([(0, _rest2.default)(function (err, nextargs) {
- 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/build/series.js b/build/series.js
deleted file mode 100644
index d7de7d9..0000000
--- a/build/series.js
+++ /dev/null
@@ -1,21 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = series;
-
-var _parallel = require('./internal/parallel');
-
-var _parallel2 = _interopRequireDefault(_parallel);
-
-var _eachOfSeries = require('./eachOfSeries');
-
-var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function series(tasks, cb) {
- return (0, _parallel2.default)(_eachOfSeries2.default, tasks, cb);
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/setImmediate.js b/build/setImmediate.js
deleted file mode 100644
index 57cdf42..0000000
--- a/build/setImmediate.js
+++ /dev/null
@@ -1,14 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _setImmediate = require('./internal/setImmediate');
-
-var _setImmediate2 = _interopRequireDefault(_setImmediate);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = _setImmediate2.default;
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/some.js b/build/some.js
deleted file mode 100644
index 624800f..0000000
--- a/build/some.js
+++ /dev/null
@@ -1,22 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _identity = require('lodash/identity');
-
-var _identity2 = _interopRequireDefault(_identity);
-
-var _createTester = require('./internal/createTester');
-
-var _createTester2 = _interopRequireDefault(_createTester);
-
-var _eachOf = require('./eachOf');
-
-var _eachOf2 = _interopRequireDefault(_eachOf);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _createTester2.default)(_eachOf2.default, Boolean, _identity2.default);
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/someLimit.js b/build/someLimit.js
deleted file mode 100644
index 5d940bd..0000000
--- a/build/someLimit.js
+++ /dev/null
@@ -1,22 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _createTester = require('./internal/createTester');
-
-var _createTester2 = _interopRequireDefault(_createTester);
-
-var _eachOfLimit = require('./eachOfLimit');
-
-var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
-
-var _identity = require('lodash/identity');
-
-var _identity2 = _interopRequireDefault(_identity);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-exports.default = (0, _createTester2.default)(_eachOfLimit2.default, Boolean, _identity2.default);
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/sortBy.js b/build/sortBy.js
deleted file mode 100644
index 0dd935f..0000000
--- a/build/sortBy.js
+++ /dev/null
@@ -1,39 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = sortBy;
-
-var _arrayMap = require('lodash/_arrayMap');
-
-var _arrayMap2 = _interopRequireDefault(_arrayMap);
-
-var _baseProperty = require('lodash/_baseProperty');
-
-var _baseProperty2 = _interopRequireDefault(_baseProperty);
-
-var _map = require('./map');
-
-var _map2 = _interopRequireDefault(_map);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function sortBy(arr, iterator, cb) {
- (0, _map2.default)(arr, function (x, cb) {
- iterator(x, function (err, criteria) {
- if (err) return cb(err);
- cb(null, { value: x, criteria: criteria });
- });
- }, function (err, results) {
- if (err) return cb(err);
- cb(null, (0, _arrayMap2.default)(results.sort(comparator), (0, _baseProperty2.default)('value')));
- });
-
- function comparator(left, right) {
- var a = left.criteria,
- b = right.criteria;
- return a < b ? -1 : a > b ? 1 : 0;
- }
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/times.js b/build/times.js
deleted file mode 100644
index e8a81a5..0000000
--- a/build/times.js
+++ /dev/null
@@ -1,21 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-exports.default = function (count, iterator, callback) {
- (0, _map2.default)((0, _baseRange2.default)(0, count, 1), iterator, callback);
-};
-
-var _map = require('./map');
-
-var _map2 = _interopRequireDefault(_map);
-
-var _baseRange = require('lodash/_baseRange');
-
-var _baseRange2 = _interopRequireDefault(_baseRange);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/timesLimit.js b/build/timesLimit.js
deleted file mode 100644
index 96f52fe..0000000
--- a/build/timesLimit.js
+++ /dev/null
@@ -1,21 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = timeLimit;
-
-var _mapLimit = require('./mapLimit');
-
-var _mapLimit2 = _interopRequireDefault(_mapLimit);
-
-var _baseRange = require('lodash/_baseRange');
-
-var _baseRange2 = _interopRequireDefault(_baseRange);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function timeLimit(count, limit, iterator, cb) {
- return (0, _mapLimit2.default)((0, _baseRange2.default)(0, count, 1), limit, iterator, cb);
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/timesSeries.js b/build/timesSeries.js
deleted file mode 100644
index bf3042c..0000000
--- a/build/timesSeries.js
+++ /dev/null
@@ -1,21 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-exports.default = function (count, iterator, callback) {
- (0, _mapSeries2.default)((0, _baseRange2.default)(0, count, 1), iterator, callback);
-};
-
-var _mapSeries = require('./mapSeries');
-
-var _mapSeries2 = _interopRequireDefault(_mapSeries);
-
-var _baseRange = require('lodash/_baseRange');
-
-var _baseRange2 = _interopRequireDefault(_baseRange);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/transform.js b/build/transform.js
deleted file mode 100644
index 311cda3..0000000
--- a/build/transform.js
+++ /dev/null
@@ -1,31 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = transform;
-
-var _isArray = require('lodash/isArray');
-
-var _isArray2 = _interopRequireDefault(_isArray);
-
-var _eachOf = require('./eachOf');
-
-var _eachOf2 = _interopRequireDefault(_eachOf);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function transform(arr, memo, iterator, callback) {
- if (arguments.length === 3) {
- callback = iterator;
- iterator = memo;
- memo = (0, _isArray2.default)(arr) ? [] : {};
- }
-
- (0, _eachOf2.default)(arr, function (v, k, cb) {
- iterator(memo, v, k, cb);
- }, function (err) {
- callback(err, memo);
- });
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/unmemoize.js b/build/unmemoize.js
deleted file mode 100644
index 512f1ca..0000000
--- a/build/unmemoize.js
+++ /dev/null
@@ -1,12 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = unmemoize;
-function unmemoize(fn) {
- return function () {
- return (fn.unmemoized || fn).apply(null, arguments);
- };
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/until.js b/build/until.js
deleted file mode 100644
index 33da3ed..0000000
--- a/build/until.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = until;
-
-var _whilst = require('./whilst');
-
-var _whilst2 = _interopRequireDefault(_whilst);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function until(test, iterator, cb) {
- return (0, _whilst2.default)(function () {
- return !test.apply(this, arguments);
- }, iterator, cb);
-}
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/waterfall.js b/build/waterfall.js
deleted file mode 100644
index af0f70d..0000000
--- a/build/waterfall.js
+++ /dev/null
@@ -1,56 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-exports.default = function (tasks, cb) {
- cb = (0, _once2.default)(cb || _noop2.default);
- if (!(0, _isArray2.default)(tasks)) return cb(new Error('First argument to waterfall must be an array of functions'));
- if (!tasks.length) return cb();
-
- function wrapIterator(iterator) {
- return (0, _rest2.default)(function (err, args) {
- if (err) {
- cb.apply(null, [err].concat(args));
- } else {
- var next = iterator.next();
- if (next) {
- args.push(wrapIterator(next));
- } else {
- args.push(cb);
- }
- (0, _ensureAsync2.default)(iterator).apply(null, args);
- }
- });
- }
- wrapIterator((0, _iterator2.default)(tasks))();
-};
-
-var _isArray = require('lodash/isArray');
-
-var _isArray2 = _interopRequireDefault(_isArray);
-
-var _noop = require('lodash/noop');
-
-var _noop2 = _interopRequireDefault(_noop);
-
-var _once = require('lodash/once');
-
-var _once2 = _interopRequireDefault(_once);
-
-var _rest = require('lodash/rest');
-
-var _rest2 = _interopRequireDefault(_rest);
-
-var _ensureAsync = require('./ensureAsync');
-
-var _ensureAsync2 = _interopRequireDefault(_ensureAsync);
-
-var _iterator = require('./iterator');
-
-var _iterator2 = _interopRequireDefault(_iterator);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-module.exports = exports['default']; \ No newline at end of file
diff --git a/build/whilst.js b/build/whilst.js
deleted file mode 100644
index 10b14a0..0000000
--- a/build/whilst.js
+++ /dev/null
@@ -1,28 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = whilst;
-
-var _noop = require('lodash/noop');
-
-var _noop2 = _interopRequireDefault(_noop);
-
-var _rest = require('lodash/rest');
-
-var _rest2 = _interopRequireDefault(_rest);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function whilst(test, iterator, cb) {
- cb = cb || _noop2.default;
- if (!test()) return cb(null);
- var next = (0, _rest2.default)(function (err, args) {
- if (err) return cb(err);
- if (test.apply(this, args)) return iterator(next);
- cb.apply(null, [null].concat(args));
- });
- iterator(next);
-}
-module.exports = exports['default']; \ No newline at end of file