diff options
Diffstat (limited to 'docs')
85 files changed, 1440 insertions, 253 deletions
diff --git a/docs/v3/apply.js.html b/docs/v3/apply.js.html index 2943566..20591a3 100644 --- a/docs/v3/apply.js.html +++ b/docs/v3/apply.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/applyEach.js.html b/docs/v3/applyEach.js.html index 60a2c11..a27d87a 100644 --- a/docs/v3/applyEach.js.html +++ b/docs/v3/applyEach.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/applyEachSeries.js.html b/docs/v3/applyEachSeries.js.html index aa3decb..9a34f62 100644 --- a/docs/v3/applyEachSeries.js.html +++ b/docs/v3/applyEachSeries.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/asyncify.js.html b/docs/v3/asyncify.js.html index 65ce37d..5d01b01 100644 --- a/docs/v3/asyncify.js.html +++ b/docs/v3/asyncify.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/auto.js.html b/docs/v3/auto.js.html index a1d65db..2454383 100644 --- a/docs/v3/auto.js.html +++ b/docs/v3/auto.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/autoInject.js.html b/docs/v3/autoInject.js.html index 937eb99..57091d3 100644 --- a/docs/v3/autoInject.js.html +++ b/docs/v3/autoInject.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/cargo.js.html b/docs/v3/cargo.js.html index 451b0bf..1fa2900 100644 --- a/docs/v3/cargo.js.html +++ b/docs/v3/cargo.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/cargoQueue.js.html b/docs/v3/cargoQueue.js.html index f406af3..23adb22 100644 --- a/docs/v3/cargoQueue.js.html +++ b/docs/v3/cargoQueue.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/compose.js.html b/docs/v3/compose.js.html index 94e4f46..151b864 100644 --- a/docs/v3/compose.js.html +++ b/docs/v3/compose.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/concat.js.html b/docs/v3/concat.js.html index 3f04061..b12aad8 100644 --- a/docs/v3/concat.js.html +++ b/docs/v3/concat.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/concatLimit.js.html b/docs/v3/concatLimit.js.html index 07284d1..ab1aab3 100644 --- a/docs/v3/concatLimit.js.html +++ b/docs/v3/concatLimit.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/concatSeries.js.html b/docs/v3/concatSeries.js.html index 55ff445..7f238b5 100644 --- a/docs/v3/concatSeries.js.html +++ b/docs/v3/concatSeries.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/constant.js.html b/docs/v3/constant.js.html index 5f4a303..f0e3e08 100644 --- a/docs/v3/constant.js.html +++ b/docs/v3/constant.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/detect.js.html b/docs/v3/detect.js.html index 056000e..977d6a5 100644 --- a/docs/v3/detect.js.html +++ b/docs/v3/detect.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/detectLimit.js.html b/docs/v3/detectLimit.js.html index ebf100b..653c16a 100644 --- a/docs/v3/detectLimit.js.html +++ b/docs/v3/detectLimit.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/detectSeries.js.html b/docs/v3/detectSeries.js.html index 2172648..d6ba392 100644 --- a/docs/v3/detectSeries.js.html +++ b/docs/v3/detectSeries.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/dir.js.html b/docs/v3/dir.js.html index 81fa717..17b9392 100644 --- a/docs/v3/dir.js.html +++ b/docs/v3/dir.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/doUntil.js.html b/docs/v3/doUntil.js.html index 348831d..3ba4abd 100644 --- a/docs/v3/doUntil.js.html +++ b/docs/v3/doUntil.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/doWhilst.js.html b/docs/v3/doWhilst.js.html index 6f94adf..f411af4 100644 --- a/docs/v3/doWhilst.js.html +++ b/docs/v3/doWhilst.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/docs.html b/docs/v3/docs.html index e4ff9a3..5afd9b7 100644 --- a/docs/v3/docs.html +++ b/docs/v3/docs.html @@ -31,7 +31,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> @@ -7391,7 +7391,7 @@ probably a good idea to do so.</p> <td class="description last"><p>A function applied to each item in the array to produce the next step in the reduction. The <code>iteratee</code> should complete with the next state of the reduction. -If the iteratee complete with an error, the reduction is stopped and the +If the iteratee completes with an error, the reduction is stopped and the main <code>callback</code> is immediately called with the error. Invoked with (memo, item, callback).</p></td> </tr> @@ -7717,7 +7717,7 @@ async () => { <td class="description last"><p>A function applied to each item in the array to produce the next step in the reduction. The <code>iteratee</code> should complete with the next state of the reduction. -If the iteratee complete with an error, the reduction is stopped and the +If the iteratee completes with an error, the reduction is stopped and the main <code>callback</code> is immediately called with the error. Invoked with (memo, item, callback).</p></td> </tr> diff --git a/docs/v3/each.js.html b/docs/v3/each.js.html index a4b7c5b..a6402d3 100644 --- a/docs/v3/each.js.html +++ b/docs/v3/each.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/eachLimit.js.html b/docs/v3/eachLimit.js.html index 1390d3e..00390c0 100644 --- a/docs/v3/eachLimit.js.html +++ b/docs/v3/eachLimit.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/eachOf.js.html b/docs/v3/eachOf.js.html index 132d37b..cace155 100644 --- a/docs/v3/eachOf.js.html +++ b/docs/v3/eachOf.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/eachOfLimit.js.html b/docs/v3/eachOfLimit.js.html index 00da9f4..d45a1df 100644 --- a/docs/v3/eachOfLimit.js.html +++ b/docs/v3/eachOfLimit.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/eachOfSeries.js.html b/docs/v3/eachOfSeries.js.html index 727ec47..c9fc3b3 100644 --- a/docs/v3/eachOfSeries.js.html +++ b/docs/v3/eachOfSeries.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/eachSeries.js.html b/docs/v3/eachSeries.js.html index 3fdeac9..b2ce191 100644 --- a/docs/v3/eachSeries.js.html +++ b/docs/v3/eachSeries.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/ensureAsync.js.html b/docs/v3/ensureAsync.js.html index dbec5dd..e3489d1 100644 --- a/docs/v3/ensureAsync.js.html +++ b/docs/v3/ensureAsync.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/every.js.html b/docs/v3/every.js.html index 7a01ede..30f89a7 100644 --- a/docs/v3/every.js.html +++ b/docs/v3/every.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/everyLimit.js.html b/docs/v3/everyLimit.js.html index bd7f748..b5e2ae6 100644 --- a/docs/v3/everyLimit.js.html +++ b/docs/v3/everyLimit.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/everySeries.js.html b/docs/v3/everySeries.js.html index 0e7c02f..4f56858 100644 --- a/docs/v3/everySeries.js.html +++ b/docs/v3/everySeries.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/filter.js.html b/docs/v3/filter.js.html index 9d191c7..19d0969 100644 --- a/docs/v3/filter.js.html +++ b/docs/v3/filter.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/filterLimit.js.html b/docs/v3/filterLimit.js.html index fc6fb3e..aabe578 100644 --- a/docs/v3/filterLimit.js.html +++ b/docs/v3/filterLimit.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/filterSeries.js.html b/docs/v3/filterSeries.js.html index b763302..12ca2df 100644 --- a/docs/v3/filterSeries.js.html +++ b/docs/v3/filterSeries.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/forever.js.html b/docs/v3/forever.js.html index 2936a16..4762adc 100644 --- a/docs/v3/forever.js.html +++ b/docs/v3/forever.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/global.html b/docs/v3/global.html index 3afe5aa..003c552 100644 --- a/docs/v3/global.html +++ b/docs/v3/global.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/groupBy.js.html b/docs/v3/groupBy.js.html index 90f5788..3a0e029 100644 --- a/docs/v3/groupBy.js.html +++ b/docs/v3/groupBy.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/groupByLimit.js.html b/docs/v3/groupByLimit.js.html index 9832959..829b3e4 100644 --- a/docs/v3/groupByLimit.js.html +++ b/docs/v3/groupByLimit.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/groupBySeries.js.html b/docs/v3/groupBySeries.js.html index 65e18f6..b139b85 100644 --- a/docs/v3/groupBySeries.js.html +++ b/docs/v3/groupBySeries.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/index.html b/docs/v3/index.html index a8f6722..9bc98e1 100644 --- a/docs/v3/index.html +++ b/docs/v3/index.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> @@ -304,6 +304,7 @@ import async from 'async-es'; <li><a href="https://www.npmjs.com/package/neo-async"><code>neo-async</code></a> an altername implementation of Async, focusing on speed.</li> <li><a href="https://www.npmjs.com/package/co-async"><code>co-async</code></a> a library inspired by Async for use with <a href="https://www.npmjs.com/package/co"><code>co</code></a> and generator functions.</li> <li><a href="https://www.npmjs.com/package/promise-async"><code>promise-async</code></a> a version of Async where all the methods are Promisified.</li> +<li><a href="https://www.npmjs.com/package/modern-async">'modern-async'</a> an alternative to Async using only async/await and promises.</li> </ul></article> </section> diff --git a/docs/v3/index.js.html b/docs/v3/index.js.html index 73cc75f..4a9ceb9 100644 --- a/docs/v3/index.js.html +++ b/docs/v3/index.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/log.js.html b/docs/v3/log.js.html index 951db8e..4e3e402 100644 --- a/docs/v3/log.js.html +++ b/docs/v3/log.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/map.js.html b/docs/v3/map.js.html index b527c06..f3104f7 100644 --- a/docs/v3/map.js.html +++ b/docs/v3/map.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/mapLimit.js.html b/docs/v3/mapLimit.js.html index bb9e6c4..8c34092 100644 --- a/docs/v3/mapLimit.js.html +++ b/docs/v3/mapLimit.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/mapSeries.js.html b/docs/v3/mapSeries.js.html index f339a13..5cf9fea 100644 --- a/docs/v3/mapSeries.js.html +++ b/docs/v3/mapSeries.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/mapValues.js.html b/docs/v3/mapValues.js.html index d1c6dd0..126b27d 100644 --- a/docs/v3/mapValues.js.html +++ b/docs/v3/mapValues.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/mapValuesLimit.js.html b/docs/v3/mapValuesLimit.js.html index d963a34..710b796 100644 --- a/docs/v3/mapValuesLimit.js.html +++ b/docs/v3/mapValuesLimit.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/mapValuesSeries.js.html b/docs/v3/mapValuesSeries.js.html index 04afec2..7bfb99f 100644 --- a/docs/v3/mapValuesSeries.js.html +++ b/docs/v3/mapValuesSeries.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/memoize.js.html b/docs/v3/memoize.js.html index 0c7c7fa..861aa3e 100644 --- a/docs/v3/memoize.js.html +++ b/docs/v3/memoize.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/module-Collections.html b/docs/v3/module-Collections.html index 6d21404..96f2d3a 100644 --- a/docs/v3/module-Collections.html +++ b/docs/v3/module-Collections.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> @@ -7251,7 +7251,7 @@ probably a good idea to do so.</p> <td class="description last"><p>A function applied to each item in the array to produce the next step in the reduction. The <code>iteratee</code> should complete with the next state of the reduction. -If the iteratee complete with an error, the reduction is stopped and the +If the iteratee completes with an error, the reduction is stopped and the main <code>callback</code> is immediately called with the error. Invoked with (memo, item, callback).</p></td> </tr> @@ -7577,7 +7577,7 @@ async () => { <td class="description last"><p>A function applied to each item in the array to produce the next step in the reduction. The <code>iteratee</code> should complete with the next state of the reduction. -If the iteratee complete with an error, the reduction is stopped and the +If the iteratee completes with an error, the reduction is stopped and the main <code>callback</code> is immediately called with the error. Invoked with (memo, item, callback).</p></td> </tr> diff --git a/docs/v3/module-ControlFlow.html b/docs/v3/module-ControlFlow.html index d48a8a7..d891a03 100644 --- a/docs/v3/module-ControlFlow.html +++ b/docs/v3/module-ControlFlow.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/module-Utils.html b/docs/v3/module-Utils.html index 82ac12c..0a8d516 100644 --- a/docs/v3/module-Utils.html +++ b/docs/v3/module-Utils.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/module-async.html b/docs/v3/module-async.html index 1108e1e..b440a88 100644 --- a/docs/v3/module-async.html +++ b/docs/v3/module-async.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/nextTick.js.html b/docs/v3/nextTick.js.html index 4a5ef99..0959ef7 100644 --- a/docs/v3/nextTick.js.html +++ b/docs/v3/nextTick.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/parallel.js.html b/docs/v3/parallel.js.html index 40af8d3..420bb0c 100644 --- a/docs/v3/parallel.js.html +++ b/docs/v3/parallel.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/parallelLimit.js.html b/docs/v3/parallelLimit.js.html index 0296bfd..fb7060f 100644 --- a/docs/v3/parallelLimit.js.html +++ b/docs/v3/parallelLimit.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/priorityQueue.js.html b/docs/v3/priorityQueue.js.html index eab3c10..417400d 100644 --- a/docs/v3/priorityQueue.js.html +++ b/docs/v3/priorityQueue.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> @@ -105,6 +105,7 @@ import Heap from './internal/Heap'; export default function(worker, concurrency) { // Start with a normal queue var q = queue(worker, concurrency); + var processingScheduled = false; q._tasks = new Heap(); @@ -132,7 +133,13 @@ export default function(worker, concurrency) { q._tasks.push(item); } - setImmediate(q.process); + if (!processingScheduled) { + processingScheduled = true; + setImmediate(() => { + processingScheduled = false; + q.process(); + }); + } }; // Remove unshift function diff --git a/docs/v3/queue.js.html b/docs/v3/queue.js.html index d4d00de..101e3a2 100644 --- a/docs/v3/queue.js.html +++ b/docs/v3/queue.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/race.js.html b/docs/v3/race.js.html index d104395..fb90327 100644 --- a/docs/v3/race.js.html +++ b/docs/v3/race.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/reduce.js.html b/docs/v3/reduce.js.html index c0c3d9e..8a048ce 100644 --- a/docs/v3/reduce.js.html +++ b/docs/v3/reduce.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> @@ -103,7 +103,7 @@ import awaitify from './internal/awaitify' * @param {AsyncFunction} iteratee - A function applied to each item in the * array to produce the next step in the reduction. * The `iteratee` should complete with the next state of the reduction. - * If the iteratee complete with an error, the reduction is stopped and the + * If the iteratee completes with an error, the reduction is stopped and the * main `callback` is immediately called with the error. * Invoked with (memo, item, callback). * @param {Function} [callback] - A callback which is called after all the @@ -208,7 +208,6 @@ function reduce(coll, memo, iteratee, callback) { }, err => callback(err, memo)); } export default awaitify(reduce, 4) - </code></pre> </article> </section> diff --git a/docs/v3/reduceRight.js.html b/docs/v3/reduceRight.js.html index 66946c6..4c58ea4 100644 --- a/docs/v3/reduceRight.js.html +++ b/docs/v3/reduceRight.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> @@ -92,7 +92,7 @@ * @param {AsyncFunction} iteratee - A function applied to each item in the * array to produce the next step in the reduction. * The `iteratee` should complete with the next state of the reduction. - * If the iteratee complete with an error, the reduction is stopped and the + * If the iteratee completes with an error, the reduction is stopped and the * main `callback` is immediately called with the error. * Invoked with (memo, item, callback). * @param {Function} [callback] - A callback which is called after all the diff --git a/docs/v3/reflect.js.html b/docs/v3/reflect.js.html index af0d576..0de6f74 100644 --- a/docs/v3/reflect.js.html +++ b/docs/v3/reflect.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/reflectAll.js.html b/docs/v3/reflectAll.js.html index c71a78b..9acee14 100644 --- a/docs/v3/reflectAll.js.html +++ b/docs/v3/reflectAll.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/reject.js.html b/docs/v3/reject.js.html index 18048d9..b63cc24 100644 --- a/docs/v3/reject.js.html +++ b/docs/v3/reject.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/rejectLimit.js.html b/docs/v3/rejectLimit.js.html index 7eb8677..3b1e11a 100644 --- a/docs/v3/rejectLimit.js.html +++ b/docs/v3/rejectLimit.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/rejectSeries.js.html b/docs/v3/rejectSeries.js.html index 759c5a0..a34ddb6 100644 --- a/docs/v3/rejectSeries.js.html +++ b/docs/v3/rejectSeries.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/retry.js.html b/docs/v3/retry.js.html index f65f8f8..0d9e655 100644 --- a/docs/v3/retry.js.html +++ b/docs/v3/retry.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/retryable.js.html b/docs/v3/retryable.js.html index 8724a71..5181b53 100644 --- a/docs/v3/retryable.js.html +++ b/docs/v3/retryable.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/scripts/async.js b/docs/v3/scripts/async.js index cafb8c9..a5ae1b2 100644 --- a/docs/v3/scripts/async.js +++ b/docs/v3/scripts/async.js @@ -62,6 +62,7 @@ /* istanbul ignore file */ + var hasQueueMicrotask = typeof queueMicrotask === 'function' && queueMicrotask; var hasSetImmediate = typeof setImmediate === 'function' && setImmediate; var hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function'; @@ -75,7 +76,9 @@ var _defer; - if (hasSetImmediate) { + if (hasQueueMicrotask) { + _defer = queueMicrotask; + } else if (hasSetImmediate) { _defer = setImmediate; } else if (hasNextTick) { _defer = process.nextTick; @@ -527,12 +530,19 @@ * @returns {Promise} a promise, if a callback is omitted * @example * - * var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; - * var configs = {}; + * // dev.json is a file containing a valid json object config for dev environment + * // dev.json is a file containing a valid json object config for test environment + * // prod.json is a file containing a valid json object config for prod environment + * // invalid.json is a file with a malformed json object * - * async.forEachOf(obj, function (value, key, callback) { - * fs.readFile(__dirname + value, "utf8", function (err, data) { - * if (err) return callback(err); + * let configs = {}; //global variable + * let validConfigFileMap = {dev: 'dev.json', test: 'test.json', prod: 'prod.json'}; + * let invalidConfigFileMap = {dev: 'dev.json', test: 'test.json', invalid: 'invalid.json'}; + * + * // asynchronous function that reads a json file and parses the contents as json object + * function parseFile(file, key, callback) { + * fs.readFile(file, "utf8", function(err, data) { + * if (err) return calback(err); * try { * configs[key] = JSON.parse(data); * } catch (e) { @@ -540,11 +550,73 @@ * } * callback(); * }); - * }, function (err) { - * if (err) console.error(err.message); - * // configs is now a map of JSON data - * doSomethingWith(configs); + * } + * + * // Using callbacks + * async.forEachOf(validConfigFileMap, parseFile, function (err) { + * if (err) { + * console.error(err); + * } else { + * console.log(configs); + * // configs is now a map of JSON data, e.g. + * // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json} + * } + * }); + * + * //Error handing + * async.forEachOf(invalidConfigFileMap, parseFile, function (err) { + * if (err) { + * console.error(err); + * // JSON parse error exception + * } else { + * console.log(configs); + * } + * }); + * + * // Using Promises + * async.forEachOf(validConfigFileMap, parseFile) + * .then( () => { + * console.log(configs); + * // configs is now a map of JSON data, e.g. + * // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json} + * }).catch( err => { + * console.error(err); + * }); + * + * //Error handing + * async.forEachOf(invalidConfigFileMap, parseFile) + * .then( () => { + * console.log(configs); + * }).catch( err => { + * console.error(err); + * // JSON parse error exception * }); + * + * // Using async/await + * async () => { + * try { + * let result = await async.forEachOf(validConfigFileMap, parseFile); + * console.log(configs); + * // configs is now a map of JSON data, e.g. + * // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json} + * } + * catch (err) { + * console.log(err); + * } + * } + * + * //Error handing + * async () => { + * try { + * let result = await async.forEachOf(invalidConfigFileMap, parseFile); + * console.log(configs); + * } + * catch (err) { + * console.log(err); + * // JSON parse error exception + * } + * } + * */ function eachOf(coll, iteratee, callback) { var eachOfImplementation = isArrayLike(coll) ? eachOfArrayLike : eachOfGeneric; @@ -586,9 +658,89 @@ * @returns {Promise} a promise, if no callback is passed * @example * - * async.map(['file1','file2','file3'], fs.stat, function(err, results) { - * // results is now an array of stats for each file + * // file1.txt is a file that is 1000 bytes in size + * // file2.txt is a file that is 2000 bytes in size + * // file3.txt is a file that is 3000 bytes in size + * // file4.txt does not exist + * + * const fileList = ['file1.txt','file2.txt','file3.txt']; + * const withMissingFileList = ['file1.txt','file2.txt','file4.txt']; + * + * // asynchronous function that returns the file size in bytes + * function getFileSizeInBytes(file, callback) { + * fs.stat(file, function(err, stat) { + * if (err) { + * return callback(err); + * } + * callback(null, stat.size); + * }); + * } + * + * // Using callbacks + * async.map(fileList, getFileSizeInBytes, function(err, results) { + * if (err) { + * console.log(err); + * } else { + * console.log(results); + * // results is now an array of the file size in bytes for each file, e.g. + * // [ 1000, 2000, 3000] + * } + * }); + * + * // Error Handling + * async.map(withMissingFileList, getFileSizeInBytes, function(err, results) { + * if (err) { + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] + * } else { + * console.log(results); + * } + * }); + * + * // Using Promises + * async.map(fileList, getFileSizeInBytes) + * .then( results => { + * console.log(results); + * // results is now an array of the file size in bytes for each file, e.g. + * // [ 1000, 2000, 3000] + * }).catch( err => { + * console.log(err); * }); + * + * // Error Handling + * async.map(withMissingFileList, getFileSizeInBytes) + * .then( results => { + * console.log(results); + * }).catch( err => { + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] + * }); + * + * // Using async/await + * async () => { + * try { + * let results = await async.map(fileList, getFileSizeInBytes); + * console.log(results); + * // results is now an array of the file size in bytes for each file, e.g. + * // [ 1000, 2000, 3000] + * } + * catch (err) { + * console.log(err); + * } + * } + * + * // Error Handling + * async () => { + * try { + * let results = await async.map(withMissingFileList, getFileSizeInBytes); + * console.log(results); + * } + * catch (err) { + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] + * } + * } + * */ function map (coll, iteratee, callback) { return _asyncMap(eachOf$1, coll, iteratee, callback) @@ -762,15 +914,40 @@ * @returns {Promise} a promise, if a callback is not passed * @example * + * //Using Callbacks * async.auto({ - * // this function will just be passed a callback - * readData: async.apply(fs.readFile, 'data.txt', 'utf-8'), - * showData: ['readData', function(results, cb) { - * // results.readData is the file's contents - * // ... + * get_data: function(callback) { + * // async code to get some data + * callback(null, 'data', 'converted to array'); + * }, + * make_folder: function(callback) { + * // 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(results, callback) { + * // 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(results, callback) { + * // once the file is written let's email a link to it... + * callback(null, {'file':results.write_file, 'email':'user@example.com'}); * }] - * }, callback); + * }, function(err, results) { + * if (err) { + * console.log('err = ', err); + * } + * console.log('results = ', results); + * // results = { + * // get_data: ['data', 'converted to array'] + * // make_folder; 'folder', + * // write_file: 'filename' + * // email_link: { file: 'filename', email: 'user@example.com' } + * // } + * }); * + * //Using Promises * async.auto({ * get_data: function(callback) { * console.log('in get_data'); @@ -784,21 +961,62 @@ * callback(null, 'folder'); * }, * write_file: ['get_data', 'make_folder', function(results, 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 * callback(null, 'filename'); * }], * email_link: ['write_file', function(results, callback) { - * 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); + * }).then(results => { * console.log('results = ', results); + * // results = { + * // get_data: ['data', 'converted to array'] + * // make_folder; 'folder', + * // write_file: 'filename' + * // email_link: { file: 'filename', email: 'user@example.com' } + * // } + * }).catch(err => { + * console.log('err = ', err); * }); + * + * //Using async/await + * async () => { + * try { + * let results = await async.auto({ + * get_data: function(callback) { + * // async code to get some data + * callback(null, 'data', 'converted to array'); + * }, + * make_folder: function(callback) { + * // 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(results, callback) { + * // 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(results, callback) { + * // once the file is written let's email a link to it... + * callback(null, {'file':results.write_file, 'email':'user@example.com'}); + * }] + * }); + * console.log('results = ', results); + * // results = { + * // get_data: ['data', 'converted to array'] + * // make_folder; 'folder', + * // write_file: 'filename' + * // email_link: { file: 'filename', email: 'user@example.com' } + * // } + * } + * catch (err) { + * console.log(err); + * } + * } + * */ function auto(tasks, concurrency, callback) { if (typeof concurrency !== 'number') { @@ -1615,14 +1833,90 @@ * @returns {Promise} a promise, if no callback is passed * @example * - * async.reduce([1,2,3], 0, function(memo, item, callback) { - * // pointless async: - * process.nextTick(function() { - * callback(null, memo + item) + * // file1.txt is a file that is 1000 bytes in size + * // file2.txt is a file that is 2000 bytes in size + * // file3.txt is a file that is 3000 bytes in size + * // file4.txt does not exist + * + * const fileList = ['file1.txt','file2.txt','file3.txt']; + * const withMissingFileList = ['file1.txt','file2.txt','file3.txt', 'file4.txt']; + * + * // asynchronous function that computes the file size in bytes + * // file size is added to the memoized value, then returned + * function getFileSizeInBytes(memo, file, callback) { + * fs.stat(file, function(err, stat) { + * if (err) { + * return callback(err); + * } + * callback(null, memo + stat.size); * }); - * }, function(err, result) { - * // result is now equal to the last value of memo, which is 6 + * } + * + * // Using callbacks + * async.reduce(fileList, 0, getFileSizeInBytes, function(err, result) { + * if (err) { + * console.log(err); + * } else { + * console.log(result); + * // 6000 + * // which is the sum of the file sizes of the three files + * } + * }); + * + * // Error Handling + * async.reduce(withMissingFileList, 0, getFileSizeInBytes, function(err, result) { + * if (err) { + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] + * } else { + * console.log(result); + * } + * }); + * + * // Using Promises + * async.reduce(fileList, 0, getFileSizeInBytes) + * .then( result => { + * console.log(result); + * // 6000 + * // which is the sum of the file sizes of the three files + * }).catch( err => { + * console.log(err); + * }); + * + * // Error Handling + * async.reduce(withMissingFileList, 0, getFileSizeInBytes) + * .then( result => { + * console.log(result); + * }).catch( err => { + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] * }); + * + * // Using async/await + * async () => { + * try { + * let result = await async.reduce(fileList, 0, getFileSizeInBytes); + * console.log(result); + * // 6000 + * // which is the sum of the file sizes of the three files + * } + * catch (err) { + * console.log(err); + * } + * } + * + * // Error Handling + * async () => { + * try { + * let result = await async.reduce(withMissingFileList, 0, getFileSizeInBytes); + * console.log(result); + * } + * catch (err) { + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] + * } + * } + * */ function reduce(coll, memo, iteratee, callback) { callback = once(callback); @@ -1826,9 +2120,77 @@ * @returns A Promise, if no callback is passed * @example * - * async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files) { - * // files is now a list of filenames that exist in the 3 directories + * // dir1 is a directory that contains file1.txt, file2.txt + * // dir2 is a directory that contains file3.txt, file4.txt + * // dir3 is a directory that contains file5.txt + * // dir4 does not exist + * + * let directoryList = ['dir1','dir2','dir3']; + * let withMissingDirectoryList = ['dir1','dir2','dir3', 'dir4']; + * + * // Using callbacks + * async.concat(directoryList, fs.readdir, function(err, results) { + * if (err) { + * console.log(err); + * } else { + * console.log(results); + * // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ] + * } + * }); + * + * // Error Handling + * async.concat(withMissingDirectoryList, fs.readdir, function(err, results) { + * if (err) { + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] + * // since dir4 does not exist + * } else { + * console.log(results); + * } * }); + * + * // Using Promises + * async.concat(directoryList, fs.readdir) + * .then(results => { + * console.log(results); + * // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ] + * }).catch(err => { + * console.log(err); + * }); + * + * // Error Handling + * async.concat(withMissingDirectoryList, fs.readdir) + * .then(results => { + * console.log(results); + * }).catch(err => { + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] + * // since dir4 does not exist + * }); + * + * // Using async/await + * async () => { + * try { + * let results = await async.concat(directoryList, fs.readdir); + * console.log(results); + * // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ] + * } catch (err) { + * console.log(err); + * } + * } + * + * // Error Handling + * async () => { + * try { + * let results = await async.concat(withMissingDirectoryList, fs.readdir); + * console.log(results); + * } catch (err) { + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] + * // since dir4 does not exist + * } + * } + * */ function concat(coll, iteratee, callback) { return concatLimit$1(coll, Infinity, iteratee, callback) @@ -1960,13 +2322,48 @@ * @returns A Promise, if no callback is passed * @example * - * async.detect(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, result) { + * // dir1 is a directory that contains file1.txt, file2.txt + * // dir2 is a directory that contains file3.txt, file4.txt + * // dir3 is a directory that contains file5.txt + * + * // asynchronous function that checks if a file exists + * function fileExists(file, callback) { + * fs.access(file, fs.constants.F_OK, (err) => { + * callback(null, !err); + * }); + * } + * + * async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists, + * function(err, result) { + * console.log(result); + * // dir1/file1.txt + * // result now equals the first file in the list that exists + * } + *); + * + * // Using Promises + * async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists) + * .then(result => { + * console.log(result); + * // dir1/file1.txt * // result now equals the first file in the list that exists + * }).catch(err => { + * console.log(err); * }); + * + * // Using async/await + * async () => { + * try { + * let result = await async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists); + * console.log(result); + * // dir1/file1.txt + * // result now equals the file in the list that exists + * } + * catch (err) { + * console.log(err); + * } + * } + * */ function detect(coll, iteratee, callback) { return _createTester(bool => bool, (res, item) => item)(eachOf$1, coll, iteratee, callback) @@ -2030,12 +2427,15 @@ function consoleFunc(name) { return (fn, ...args) => wrapAsync(fn)(...args, (err, ...resultArgs) => { + /* istanbul ignore else */ if (typeof console === 'object') { + /* istanbul ignore else */ if (err) { + /* istanbul ignore else */ if (console.error) { console.error(err); } - } else if (console[name]) { + } else if (console[name]) { /* istanbul ignore else */ resultArgs.forEach(x => console[name](x)); } } @@ -2180,37 +2580,78 @@ * @returns {Promise} a promise, if a callback is omitted * @example * - * // assuming openFiles is an array of file names and saveFile is a function - * // to save the modified contents of that file: + * // dir1 is a directory that contains file1.txt, file2.txt + * // dir2 is a directory that contains file3.txt, file4.txt + * // dir3 is a directory that contains file5.txt + * // dir4 does not exist * - * async.each(openFiles, saveFile, function(err){ - * // if any of the saves produced an error, err would equal that error - * }); + * const fileList = [ 'dir1/file2.txt', 'dir2/file3.txt', 'dir/file5.txt']; + * const withMissingFileList = ['dir1/file1.txt', 'dir4/file2.txt']; * - * // assuming openFiles is an array of file names - * async.each(openFiles, function(file, callback) { - * - * // Perform operation on file here. - * console.log('Processing file ' + file); + * // asynchronous function that deletes a file + * const deleteFile = function(file, callback) { + * fs.unlink(file, callback); + * }; * - * 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 + * // Using callbacks + * async.each(fileList, deleteFile, function(err) { * if( err ) { - * // One of the iterations produced an error. - * // All processing will now stop. - * console.log('A file failed to process'); + * console.log(err); * } else { - * console.log('All files have been processed successfully'); + * console.log('All files have been deleted successfully'); * } * }); + * + * // Error Handling + * async.each(withMissingFileList, deleteFile, function(err){ + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] + * // since dir4/file2.txt does not exist + * // dir1/file1.txt could have been deleted + * }); + * + * // Using Promises + * async.each(fileList, deleteFile) + * .then( () => { + * console.log('All files have been deleted successfully'); + * }).catch( err => { + * console.log(err); + * }); + * + * // Error Handling + * async.each(fileList, deleteFile) + * .then( () => { + * console.log('All files have been deleted successfully'); + * }).catch( err => { + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] + * // since dir4/file2.txt does not exist + * // dir1/file1.txt could have been deleted + * }); + * + * // Using async/await + * async () => { + * try { + * await async.each(files, deleteFile); + * } + * catch (err) { + * console.log(err); + * } + * } + * + * // Error Handling + * async () => { + * try { + * await async.each(withMissingFileList, deleteFile); + * } + * catch (err) { + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] + * // since dir4/file2.txt does not exist + * // dir1/file1.txt could have been deleted + * } + * } + * */ function eachLimit(coll, iteratee, callback) { return eachOf$1(coll, _withoutIndex(wrapAsync(iteratee)), callback); @@ -2345,13 +2786,78 @@ * @returns {Promise} a promise, if no callback provided * @example * - * 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 + * // dir1 is a directory that contains file1.txt, file2.txt + * // dir2 is a directory that contains file3.txt, file4.txt + * // dir3 is a directory that contains file5.txt + * // dir4 does not exist + * + * const fileList = ['dir1/file1.txt','dir2/file3.txt','dir3/file5.txt']; + * const withMissingFileList = ['file1.txt','file2.txt','file4.txt']; + * + * // asynchronous function that checks if a file exists + * function fileExists(file, callback) { + * fs.access(file, fs.constants.F_OK, (err) => { + * callback(null, !err); + * }); + * } + * + * // Using callbacks + * async.every(fileList, fileExists, function(err, result) { + * console.log(result); + * // true + * // result is true since every file exists * }); + * + * async.every(withMissingFileList, fileExists, function(err, result) { + * console.log(result); + * // false + * // result is false since NOT every file exists + * }); + * + * // Using Promises + * async.every(fileList, fileExists) + * .then( result => { + * console.log(result); + * // true + * // result is true since every file exists + * }).catch( err => { + * console.log(err); + * }); + * + * async.every(withMissingFileList, fileExists) + * .then( result => { + * console.log(result); + * // false + * // result is false since NOT every file exists + * }).catch( err => { + * console.log(err); + * }); + * + * // Using async/await + * async () => { + * try { + * let result = await async.every(fileList, fileExists); + * console.log(result); + * // true + * // result is true since every file exists + * } + * catch (err) { + * console.log(err); + * } + * } + * + * async () => { + * try { + * let result = await async.every(withMissingFileList, fileExists); + * console.log(result); + * // false + * // result is false since NOT every file exists + * } + * catch (err) { + * console.log(err); + * } + * } + * */ function every(coll, iteratee, callback) { return _createTester(bool => !bool, res => !res)(eachOf$1, coll, iteratee, callback) @@ -2469,13 +2975,53 @@ * @returns {Promise} a promise, if no callback provided * @example * - * 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 + * // dir1 is a directory that contains file1.txt, file2.txt + * // dir2 is a directory that contains file3.txt, file4.txt + * // dir3 is a directory that contains file5.txt + * + * const files = ['dir1/file1.txt','dir2/file3.txt','dir3/file6.txt']; + * + * // asynchronous function that checks if a file exists + * function fileExists(file, callback) { + * fs.access(file, fs.constants.F_OK, (err) => { + * callback(null, !err); + * }); + * } + * + * // Using callbacks + * async.filter(files, fileExists, function(err, results) { + * if(err) { + * console.log(err); + * } else { + * console.log(results); + * // [ 'dir1/file1.txt', 'dir2/file3.txt' ] + * // results is now an array of the existing files + * } * }); + * + * // Using Promises + * async.filter(files, fileExists) + * .then(results => { + * console.log(results); + * // [ 'dir1/file1.txt', 'dir2/file3.txt' ] + * // results is now an array of the existing files + * }).catch(err => { + * console.log(err); + * }); + * + * // Using async/await + * async () => { + * try { + * let results = await async.filter(files, fileExists); + * console.log(results); + * // [ 'dir1/file1.txt', 'dir2/file3.txt' ] + * // results is now an array of the existing files + * } + * catch (err) { + * console.log(err); + * } + * } + * */ function filter (coll, iteratee, callback) { return _filter(eachOf$1, coll, iteratee, callback) @@ -2590,7 +3136,7 @@ * The iteratee should complete with a `key` to group the value under. * Invoked with (value, callback). * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Result is an `Object` whose + * functions have finished, or an error occurs. Result is an `Object` whoses * properties are arrays of values which returned the corresponding key. * @returns {Promise} a promise, if no callback is passed */ @@ -2647,20 +3193,74 @@ * The iteratee should complete with a `key` to group the value under. * Invoked with (value, callback). * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Result is an `Object` whose + * functions have finished, or an error occurs. Result is an `Object` whoses * properties are arrays of values which returned the corresponding key. * @returns {Promise} a promise, if no callback is passed * @example * - * async.groupBy(['userId1', 'userId2', 'userId3'], function(userId, callback) { - * db.findById(userId, function(err, user) { - * if (err) return callback(err); - * return callback(null, user.age); + * // dir1 is a directory that contains file1.txt, file2.txt + * // dir2 is a directory that contains file3.txt, file4.txt + * // dir3 is a directory that contains file5.txt + * // dir4 does not exist + * + * const files = ['dir1/file1.txt','dir2','dir4'] + * + * // asynchronous function that detects file type as none, file, or directory + * function detectFile(file, callback) { + * fs.stat(file, function(err, stat) { + * if (err) { + * return callback(null, 'none'); + * } + * callback(null, stat.isDirectory() ? 'directory' : 'file'); * }); - * }, function(err, result) { - * // result is object containing the userIds grouped by age - * // e.g. { 30: ['userId1', 'userId3'], 42: ['userId2']}; + * } + * + * //Using callbacks + * async.groupBy(files, detectFile, function(err, result) { + * if(err) { + * console.log(err); + * } else { + * console.log(result); + * // { + * // file: [ 'dir1/file1.txt' ], + * // none: [ 'dir4' ], + * // directory: [ 'dir2'] + * // } + * // result is object containing the files grouped by type + * } * }); + * + * // Using Promises + * async.groupBy(files, detectFile) + * .then( result => { + * console.log(result); + * // { + * // file: [ 'dir1/file1.txt' ], + * // none: [ 'dir4' ], + * // directory: [ 'dir2'] + * // } + * // result is object containing the files grouped by type + * }).catch( err => { + * console.log(err); + * }); + * + * // Using async/await + * async () => { + * try { + * let result = await async.groupBy(files, detectFile); + * console.log(result); + * // { + * // file: [ 'dir1/file1.txt' ], + * // none: [ 'dir4' ], + * // directory: [ 'dir2'] + * // } + * // result is object containing the files grouped by type + * } + * catch (err) { + * console.log(err); + * } + * } + * */ function groupBy (coll, iteratee, callback) { return groupByLimit$1(coll, Infinity, iteratee, callback) @@ -2785,20 +3385,110 @@ * @returns {Promise} a promise, if no callback is passed * @example * - * async.mapValues({ - * f1: 'file1', - * f2: 'file2', - * f3: 'file3' - * }, function (file, key, callback) { - * fs.stat(file, callback); - * }, function(err, result) { - * // result is now a map of stats for each file, e.g. + * // file1.txt is a file that is 1000 bytes in size + * // file2.txt is a file that is 2000 bytes in size + * // file3.txt is a file that is 3000 bytes in size + * // file4.txt does not exist + * + * const fileMap = { + * f1: 'file1.txt', + * f2: 'file2.txt', + * f3: 'file3.txt' + * }; + * + * const withMissingFileMap = { + * f1: 'file1.txt', + * f2: 'file2.txt', + * f3: 'file4.txt' + * }; + * + * // asynchronous function that returns the file size in bytes + * function getFileSizeInBytes(file, key, callback) { + * fs.stat(file, function(err, stat) { + * if (err) { + * return callback(err); + * } + * callback(null, stat.size); + * }); + * } + * + * // Using callbacks + * async.mapValues(fileMap, getFileSizeInBytes, function(err, result) { + * if (err) { + * console.log(err); + * } else { + * console.log(result); + * // result is now a map of file size in bytes for each file, e.g. + * // { + * // f1: 1000, + * // f2: 2000, + * // f3: 3000 + * // } + * } + * }); + * + * // Error handling + * async.mapValues(withMissingFileMap, getFileSizeInBytes, function(err, result) { + * if (err) { + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] + * } else { + * console.log(result); + * } + * }); + * + * // Using Promises + * async.mapValues(fileMap, getFileSizeInBytes) + * .then( result => { + * console.log(result); + * // result is now a map of file size in bytes for each file, e.g. * // { - * // f1: [stats for file1], - * // f2: [stats for file2], - * // f3: [stats for file3] + * // f1: 1000, + * // f2: 2000, + * // f3: 3000 * // } + * }).catch (err => { + * console.log(err); * }); + * + * // Error Handling + * async.mapValues(withMissingFileMap, getFileSizeInBytes) + * .then( result => { + * console.log(result); + * }).catch (err => { + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] + * }); + * + * // Using async/await + * async () => { + * try { + * let result = await async.mapValues(fileMap, getFileSizeInBytes); + * console.log(result); + * // result is now a map of file size in bytes for each file, e.g. + * // { + * // f1: 1000, + * // f2: 2000, + * // f3: 3000 + * // } + * } + * catch (err) { + * console.log(err); + * } + * } + * + * // Error Handling + * async () => { + * try { + * let result = await async.mapValues(withMissingFileMap, getFileSizeInBytes); + * console.log(result); + * } + * catch (err) { + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] + * } + * } + * */ function mapValues(obj, iteratee, callback) { return mapValuesLimit$1(obj, Infinity, iteratee, callback) @@ -2941,7 +3631,7 @@ var nextTick = wrap(_defer$1); - var parallel = awaitify((eachfn, tasks, callback) => { + var _parallel = awaitify((eachfn, tasks, callback) => { var results = isArrayLike(tasks) ? [] : {}; eachfn(tasks, (task, key, taskCb) => { @@ -2991,6 +3681,8 @@ * @returns {Promise} a promise, if a callback is not passed * * @example + * + * //Using Callbacks * async.parallel([ * function(callback) { * setTimeout(function() { @@ -3002,10 +3694,9 @@ * callback(null, 'two'); * }, 100); * } - * ], - * // optional callback - * function(err, results) { - * // the results array will equal ['one','two'] even though + * ], function(err, results) { + * console.log(results); + * // results is equal to ['one','two'] even though * // the second function had a shorter timeout. * }); * @@ -3022,11 +3713,99 @@ * }, 100); * } * }, function(err, results) { - * // results is now equals to: {one: 1, two: 2} + * console.log(results); + * // results is equal to: { one: 1, two: 2 } + * }); + * + * //Using Promises + * async.parallel([ + * function(callback) { + * setTimeout(function() { + * callback(null, 'one'); + * }, 200); + * }, + * function(callback) { + * setTimeout(function() { + * callback(null, 'two'); + * }, 100); + * } + * ]).then(results => { + * console.log(results); + * // results is equal to ['one','two'] even though + * // the second function had a shorter timeout. + * }).catch(err => { + * console.log(err); + * }); + * + * // 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); + * } + * }).then(results => { + * console.log(results); + * // results is equal to: { one: 1, two: 2 } + * }).catch(err => { + * console.log(err); * }); + * + * //Using async/await + * async () => { + * try { + * let results = await async.parallel([ + * function(callback) { + * setTimeout(function() { + * callback(null, 'one'); + * }, 200); + * }, + * function(callback) { + * setTimeout(function() { + * callback(null, 'two'); + * }, 100); + * } + * ]); + * console.log(results); + * // results is equal to ['one','two'] even though + * // the second function had a shorter timeout. + * } + * catch (err) { + * console.log(err); + * } + * } + * + * // an example using an object instead of an array + * async () => { + * try { + * let results = await async.parallel({ + * one: function(callback) { + * setTimeout(function() { + * callback(null, 1); + * }, 200); + * }, + * two: function(callback) { + * setTimeout(function() { + * callback(null, 2); + * }, 100); + * } + * }); + * console.log(results); + * // results is equal to: { one: 1, two: 2 } + * } + * catch (err) { + * console.log(err); + * } + * } + * */ - function parallel$1(tasks, callback) { - return parallel(eachOf$1, tasks, callback); + function parallel(tasks, callback) { + return _parallel(eachOf$1, tasks, callback); } /** @@ -3050,7 +3829,7 @@ * @returns {Promise} a promise, if a callback is not passed */ function parallelLimit(tasks, limit, callback) { - return parallel(eachOfLimit(limit), tasks, callback); + return _parallel(eachOfLimit(limit), tasks, callback); } /** @@ -3343,6 +4122,7 @@ function priorityQueue(worker, concurrency) { // Start with a normal queue var q = queue$1(worker, concurrency); + var processingScheduled = false; q._tasks = new Heap(); @@ -3370,7 +4150,13 @@ q._tasks.push(item); } - setImmediate$1(q.process); + if (!processingScheduled) { + processingScheduled = true; + setImmediate$1(() => { + processingScheduled = false; + q.process(); + }); + } }; // Remove unshift function @@ -3623,14 +4409,48 @@ * @returns {Promise} a promise, if no callback is passed * @example * - * async.reject(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, results) { - * // results now equals an array of missing files - * createFiles(results); + * // dir1 is a directory that contains file1.txt, file2.txt + * // dir2 is a directory that contains file3.txt, file4.txt + * // dir3 is a directory that contains file5.txt + * + * const fileList = ['dir1/file1.txt','dir2/file3.txt','dir3/file6.txt']; + * + * // asynchronous function that checks if a file exists + * function fileExists(file, callback) { + * fs.access(file, fs.constants.F_OK, (err) => { + * callback(null, !err); + * }); + * } + * + * // Using callbacks + * async.reject(fileList, fileExists, function(err, results) { + * // [ 'dir3/file6.txt' ] + * // results now equals an array of the non-existing files + * }); + * + * // Using Promises + * async.reject(fileList, fileExists) + * .then( results => { + * console.log(results); + * // [ 'dir3/file6.txt' ] + * // results now equals an array of the non-existing files + * }).catch( err => { + * console.log(err); * }); + * + * // Using async/await + * async () => { + * try { + * let results = await async.reject(fileList, fileExists); + * console.log(results); + * // [ 'dir3/file6.txt' ] + * // results now equals an array of the non-existing files + * } + * catch (err) { + * console.log(err); + * } + * } + * */ function reject$1 (coll, iteratee, callback) { return reject(eachOf$1, coll, iteratee, callback) @@ -3923,38 +4743,138 @@ * with (err, result). * @return {Promise} a promise, if no callback is passed * @example + * + * //Using Callbacks * async.series([ * function(callback) { - * // do some stuff ... - * callback(null, 'one'); + * setTimeout(function() { + * // do some async task + * callback(null, 'one'); + * }, 200); * }, * function(callback) { - * // do some more stuff ... - * callback(null, 'two'); + * setTimeout(function() { + * // then do another async task + * callback(null, 'two'); + * }, 100); * } - * ], - * // optional callback - * function(err, results) { - * // results is now equal to ['one', 'two'] + * ], function(err, results) { + * console.log(results); + * // results is equal to ['one','two'] * }); * + * // an example using objects instead of arrays * async.series({ * one: function(callback) { * setTimeout(function() { + * // do some async task * callback(null, 1); * }, 200); * }, - * two: function(callback){ + * two: function(callback) { * setTimeout(function() { + * // then do another async task * callback(null, 2); * }, 100); * } * }, function(err, results) { - * // results is now equal to: {one: 1, two: 2} + * console.log(results); + * // results is equal to: { one: 1, two: 2 } + * }); + * + * //Using Promises + * async.series([ + * function(callback) { + * setTimeout(function() { + * callback(null, 'one'); + * }, 200); + * }, + * function(callback) { + * setTimeout(function() { + * callback(null, 'two'); + * }, 100); + * } + * ]).then(results => { + * console.log(results); + * // results is equal to ['one','two'] + * }).catch(err => { + * console.log(err); + * }); + * + * // an example using an object instead of an array + * async.series({ + * one: function(callback) { + * setTimeout(function() { + * // do some async task + * callback(null, 1); + * }, 200); + * }, + * two: function(callback) { + * setTimeout(function() { + * // then do another async task + * callback(null, 2); + * }, 100); + * } + * }).then(results => { + * console.log(results); + * // results is equal to: { one: 1, two: 2 } + * }).catch(err => { + * console.log(err); * }); + * + * //Using async/await + * async () => { + * try { + * let results = await async.series([ + * function(callback) { + * setTimeout(function() { + * // do some async task + * callback(null, 'one'); + * }, 200); + * }, + * function(callback) { + * setTimeout(function() { + * // then do another async task + * callback(null, 'two'); + * }, 100); + * } + * ]); + * console.log(results); + * // results is equal to ['one','two'] + * } + * catch (err) { + * console.log(err); + * } + * } + * + * // an example using an object instead of an array + * async () => { + * try { + * let results = await async.parallel({ + * one: function(callback) { + * setTimeout(function() { + * // do some async task + * callback(null, 1); + * }, 200); + * }, + * two: function(callback) { + * setTimeout(function() { + * // then do another async task + * callback(null, 2); + * }, 100); + * } + * }); + * console.log(results); + * // results is equal to: { one: 1, two: 2 } + * } + * catch (err) { + * console.log(err); + * } + * } + * */ function series(tasks, callback) { - return parallel(eachOfSeries$1, tasks, callback); + return _parallel(eachOfSeries$1, tasks, callback); } /** @@ -3980,13 +4900,79 @@ * @returns {Promise} a promise, if no callback provided * @example * - * 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 + * // dir1 is a directory that contains file1.txt, file2.txt + * // dir2 is a directory that contains file3.txt, file4.txt + * // dir3 is a directory that contains file5.txt + * // dir4 does not exist + * + * // asynchronous function that checks if a file exists + * function fileExists(file, callback) { + * fs.access(file, fs.constants.F_OK, (err) => { + * callback(null, !err); + * }); + * } + * + * // Using callbacks + * async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists, + * function(err, result) { + * console.log(result); + * // true + * // result is true since some file in the list exists + * } + *); + * + * async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists, + * function(err, result) { + * console.log(result); + * // false + * // result is false since none of the files exists + * } + *); + * + * // Using Promises + * async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists) + * .then( result => { + * console.log(result); + * // true + * // result is true since some file in the list exists + * }).catch( err => { + * console.log(err); + * }); + * + * async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists) + * .then( result => { + * console.log(result); + * // false + * // result is false since none of the files exists + * }).catch( err => { + * console.log(err); * }); + * + * // Using async/await + * async () => { + * try { + * let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists); + * console.log(result); + * // true + * // result is true since some file in the list exists + * } + * catch (err) { + * console.log(err); + * } + * } + * + * async () => { + * try { + * let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists); + * console.log(result); + * // false + * // result is false since none of the files exists + * } + * catch (err) { + * console.log(err); + * } + * } + * */ function some(coll, iteratee, callback) { return _createTester(Boolean, res => res)(eachOf$1, coll, iteratee, callback) @@ -4068,31 +5054,133 @@ * @returns {Promise} a promise, if no callback passed * @example * - * async.sortBy(['file1','file2','file3'], function(file, callback) { - * fs.stat(file, function(err, stats) { - * callback(err, stats.mtime); + * // bigfile.txt is a file that is 251100 bytes in size + * // mediumfile.txt is a file that is 11000 bytes in size + * // smallfile.txt is a file that is 121 bytes in size + * + * // asynchronous function that returns the file size in bytes + * function getFileSizeInBytes(file, callback) { + * fs.stat(file, function(err, stat) { + * if (err) { + * return callback(err); + * } + * callback(null, stat.size); * }); - * }, function(err, results) { - * // results is now the original array of files sorted by - * // modified date - * }); + * } + * + * // Using callbacks + * async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], getFileSizeInBytes, + * function(err, results) { + * if (err) { + * console.log(err); + * } else { + * console.log(results); + * // results is now the original array of files sorted by + * // file size (ascending by default), e.g. + * // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt'] + * } + * } + * ); * * // By modifying the callback parameter the * // sorting order can be influenced: * * // ascending order - * async.sortBy([1,9,3,5], function(x, callback) { - * callback(null, x); - * }, function(err,result) { - * // result callback - * }); + * async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], function(file, callback) { + * getFileSizeInBytes(file, function(getFileSizeErr, fileSize) { + * if (getFileSizeErr) return callback(getFileSizeErr); + * callback(null, fileSize); + * }); + * }, function(err, results) { + * if (err) { + * console.log(err); + * } else { + * console.log(results); + * // results is now the original array of files sorted by + * // file size (ascending by default), e.g. + * // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt'] + * } + * } + * ); * * // 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 + * async.sortBy(['bigfile.txt','mediumfile.txt','smallfile.txt'], function(file, callback) { + * getFileSizeInBytes(file, function(getFileSizeErr, fileSize) { + * if (getFileSizeErr) { + * return callback(getFileSizeErr); + * } + * callback(null, fileSize * -1); + * }); + * }, function(err, results) { + * if (err) { + * console.log(err); + * } else { + * console.log(results); + * // results is now the original array of files sorted by + * // file size (ascending by default), e.g. + * // [ 'bigfile.txt', 'mediumfile.txt', 'smallfile.txt'] + * } + * } + * ); + * + * // Error handling + * async.sortBy(['mediumfile.txt','smallfile.txt','missingfile.txt'], getFileSizeInBytes, + * function(err, results) { + * if (err) { + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] + * } else { + * console.log(results); + * } + * } + * ); + * + * // Using Promises + * async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], getFileSizeInBytes) + * .then( results => { + * console.log(results); + * // results is now the original array of files sorted by + * // file size (ascending by default), e.g. + * // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt'] + * }).catch( err => { + * console.log(err); + * }); + * + * // Error handling + * async.sortBy(['mediumfile.txt','smallfile.txt','missingfile.txt'], getFileSizeInBytes) + * .then( results => { + * console.log(results); + * }).catch( err => { + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] * }); + * + * // Using async/await + * (async () => { + * try { + * let results = await async.sortBy(['bigfile.txt','mediumfile.txt','smallfile.txt'], getFileSizeInBytes); + * console.log(results); + * // results is now the original array of files sorted by + * // file size (ascending by default), e.g. + * // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt'] + * } + * catch (err) { + * console.log(err); + * } + * })(); + * + * // Error handling + * async () => { + * try { + * let results = await async.sortBy(['missingfile.txt','mediumfile.txt','smallfile.txt'], getFileSizeInBytes); + * console.log(results); + * } + * catch (err) { + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] + * } + * } + * */ function sortBy (coll, iteratee, callback) { var _iteratee = wrapAsync(iteratee); @@ -4293,26 +5381,118 @@ * @returns {Promise} a promise, if no callback provided * @example * - * async.transform([1,2,3], function(acc, item, index, callback) { - * // pointless async: - * process.nextTick(function() { - * acc[index] = item * 2 - * callback(null) + * // file1.txt is a file that is 1000 bytes in size + * // file2.txt is a file that is 2000 bytes in size + * // file3.txt is a file that is 3000 bytes in size + * + * // helper function that returns human-readable size format from bytes + * function formatBytes(bytes, decimals = 2) { + * // implementation not included for brevity + * return humanReadbleFilesize; + * } + * + * const fileList = ['file1.txt','file2.txt','file3.txt']; + * + * // asynchronous function that returns the file size, transformed to human-readable format + * // e.g. 1024 bytes = 1KB, 1234 bytes = 1.21 KB, 1048576 bytes = 1MB, etc. + * function transformFileSize(acc, value, key, callback) { + * fs.stat(value, function(err, stat) { + * if (err) { + * return callback(err); + * } + * acc[key] = formatBytes(stat.size); + * callback(null); * }); - * }, function(err, result) { - * // result is now equal to [2, 4, 6] + * } + * + * // Using callbacks + * async.transform(fileList, transformFileSize, function(err, result) { + * if(err) { + * console.log(err); + * } else { + * console.log(result); + * // [ '1000 Bytes', '1.95 KB', '2.93 KB' ] + * } * }); * + * // Using Promises + * async.transform(fileList, transformFileSize) + * .then(result => { + * console.log(result); + * // [ '1000 Bytes', '1.95 KB', '2.93 KB' ] + * }).catch(err => { + * console.log(err); + * }); + * + * // Using async/await + * (async () => { + * try { + * let result = await async.transform(fileList, transformFileSize); + * console.log(result); + * // [ '1000 Bytes', '1.95 KB', '2.93 KB' ] + * } + * catch (err) { + * console.log(err); + * } + * })(); + * * @example * - * async.transform({a: 1, b: 2, c: 3}, function (obj, val, key, callback) { - * setImmediate(function () { - * obj[key] = val * 2; - * callback(); - * }) - * }, function (err, result) { - * // result is equal to {a: 2, b: 4, c: 6} - * }) + * // file1.txt is a file that is 1000 bytes in size + * // file2.txt is a file that is 2000 bytes in size + * // file3.txt is a file that is 3000 bytes in size + * + * // helper function that returns human-readable size format from bytes + * function formatBytes(bytes, decimals = 2) { + * // implementation not included for brevity + * return humanReadbleFilesize; + * } + * + * const fileMap = { f1: 'file1.txt', f2: 'file2.txt', f3: 'file3.txt' }; + * + * // asynchronous function that returns the file size, transformed to human-readable format + * // e.g. 1024 bytes = 1KB, 1234 bytes = 1.21 KB, 1048576 bytes = 1MB, etc. + * function transformFileSize(acc, value, key, callback) { + * fs.stat(value, function(err, stat) { + * if (err) { + * return callback(err); + * } + * acc[key] = formatBytes(stat.size); + * callback(null); + * }); + * } + * + * // Using callbacks + * async.transform(fileMap, transformFileSize, function(err, result) { + * if(err) { + * console.log(err); + * } else { + * console.log(result); + * // { f1: '1000 Bytes', f2: '1.95 KB', f3: '2.93 KB' } + * } + * }); + * + * // Using Promises + * async.transform(fileMap, transformFileSize) + * .then(result => { + * console.log(result); + * // { f1: '1000 Bytes', f2: '1.95 KB', f3: '2.93 KB' } + * }).catch(err => { + * console.log(err); + * }); + * + * // Using async/await + * async () => { + * try { + * let result = await async.transform(fileMap, transformFileSize); + * console.log(result); + * // { f1: '1000 Bytes', f2: '1.95 KB', f3: '2.93 KB' } + * } + * catch (err) { + * console.log(err); + * } + * } + * */ function transform (coll, accumulator, iteratee, callback) { if (arguments.length <= 3 && typeof accumulator === 'function') { @@ -4490,7 +5670,7 @@ * @example * const results = [] * let finished = false - * async.until(function test(page, cb) { + * async.until(function test(cb) { * cb(null, finished) * }, function iter(next) { * fetchPage(url, (err, body) => { @@ -4674,7 +5854,7 @@ mapValuesSeries, memoize, nextTick, - parallel: parallel$1, + parallel, parallelLimit, priorityQueue, queue: queue$1, @@ -4782,7 +5962,7 @@ exports.mapValuesSeries = mapValuesSeries; exports.memoize = memoize; exports.nextTick = nextTick; - exports.parallel = parallel$1; + exports.parallel = parallel; exports.parallelLimit = parallelLimit; exports.priorityQueue = priorityQueue; exports.queue = queue$1; diff --git a/docs/v3/seq.js.html b/docs/v3/seq.js.html index 2a47ead..ca0cbb1 100644 --- a/docs/v3/seq.js.html +++ b/docs/v3/seq.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/series.js.html b/docs/v3/series.js.html index bef4a61..0148c3e 100644 --- a/docs/v3/series.js.html +++ b/docs/v3/series.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/setImmediate.js.html b/docs/v3/setImmediate.js.html index b13f474..d22ef38 100644 --- a/docs/v3/setImmediate.js.html +++ b/docs/v3/setImmediate.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/some.js.html b/docs/v3/some.js.html index 4d89fac..ee4ff81 100644 --- a/docs/v3/some.js.html +++ b/docs/v3/some.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/someLimit.js.html b/docs/v3/someLimit.js.html index 4ad128a..7f187a6 100644 --- a/docs/v3/someLimit.js.html +++ b/docs/v3/someLimit.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/someSeries.js.html b/docs/v3/someSeries.js.html index 30a9168..f8ac517 100644 --- a/docs/v3/someSeries.js.html +++ b/docs/v3/someSeries.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/sortBy.js.html b/docs/v3/sortBy.js.html index 7bd91ed..04323f9 100644 --- a/docs/v3/sortBy.js.html +++ b/docs/v3/sortBy.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/timeout.js.html b/docs/v3/timeout.js.html index 017cee8..45fcc7e 100644 --- a/docs/v3/timeout.js.html +++ b/docs/v3/timeout.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/times.js.html b/docs/v3/times.js.html index 6202a24..88fa623 100644 --- a/docs/v3/times.js.html +++ b/docs/v3/times.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/timesLimit.js.html b/docs/v3/timesLimit.js.html index 18d946f..58ad633 100644 --- a/docs/v3/timesLimit.js.html +++ b/docs/v3/timesLimit.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/timesSeries.js.html b/docs/v3/timesSeries.js.html index 5b062dc..a9bae07 100644 --- a/docs/v3/timesSeries.js.html +++ b/docs/v3/timesSeries.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/transform.js.html b/docs/v3/transform.js.html index cb5324a..c9b34ef 100644 --- a/docs/v3/transform.js.html +++ b/docs/v3/transform.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/tryEach.js.html b/docs/v3/tryEach.js.html index c69c784..e42122d 100644 --- a/docs/v3/tryEach.js.html +++ b/docs/v3/tryEach.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/unmemoize.js.html b/docs/v3/unmemoize.js.html index f30ae01..a36f655 100644 --- a/docs/v3/unmemoize.js.html +++ b/docs/v3/unmemoize.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/until.js.html b/docs/v3/until.js.html index 5cb8c52..646a663 100644 --- a/docs/v3/until.js.html +++ b/docs/v3/until.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/waterfall.js.html b/docs/v3/waterfall.js.html index eb6c74a..8b80db5 100644 --- a/docs/v3/waterfall.js.html +++ b/docs/v3/waterfall.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> diff --git a/docs/v3/whilst.js.html b/docs/v3/whilst.js.html index d81c0bd..b957f53 100644 --- a/docs/v3/whilst.js.html +++ b/docs/v3/whilst.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.0 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.1 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> |