diff options
Diffstat (limited to 'docs/function/index.html')
-rw-r--r-- | docs/function/index.html | 6168 |
1 files changed, 6168 insertions, 0 deletions
diff --git a/docs/function/index.html b/docs/function/index.html new file mode 100644 index 0000000..1df60c9 --- /dev/null +++ b/docs/function/index.html @@ -0,0 +1,6168 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <base data-ice="baseUrl" href="../"> + <title data-ice="title">Function | API Document</title> + <link type="text/css" rel="stylesheet" href="css/style.css"> + <link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css"> + <script src="script/prettify/prettify.js"></script> + + + <script src="script/manual.js"></script> +</head> +<body class="layout-container" data-ice="rootContainer"> + +<header> + <a href="./">Home</a> + + <a href="identifiers.html">Reference</a> + <a href="source.html">Source</a> + + <a data-ice="repoURL" href="https://github.com/caolan/async.git" class="repo-url-github">Repository</a> + <div class="search-box"> + <span> + <img src="./image/search.png"> + <span class="search-input-edge"></span><input class="search-input"><span class="search-input-edge"></span> + </span> + <ul class="search-result"></ul> + </div> +</header> + +<nav class="navigation" data-ice="nav"><div> + <ul> + + <li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-asyncify">asyncify</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-auto">auto</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-autoInject">autoInject</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-cargo">cargo</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-compose">compose</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-doDuring">doDuring</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-doUntil">doUntil</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-doWhilst">doWhilst</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-during">during</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-eachLimit">eachLimit</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-eachOfLimit">eachOfLimit</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-ensureAsync">ensureAsync</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-forever">forever</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-iterator">iterator</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-mapValuesLimit">mapValuesLimit</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-memoize">memoize</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-parallelLimit">parallelLimit</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-priorityQueue">priorityQueue</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-queue">queue</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-race">race</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-reduce">reduce</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-reduceRight">reduceRight</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-reflect">reflect</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-reflectAll">reflectAll</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-retry">retry</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-retryable">retryable</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-series">series</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-sortBy">sortBy</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-timeout">timeout</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-timeLimit">timeLimit</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-transform">transform</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-unmemoize">unmemoize</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-until">until</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-waterfall">waterfall</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-whilst">whilst</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-CargoObject">CargoObject</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-typedef">T</span><span data-ice="name"><span><a href="typedef/index.html#static-typedef-QueueObject">QueueObject</a></span></span></li> +<li data-ice="doc"><div data-ice="dirPath" class="nav-dir-path">internal</div><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-applyEach">applyEach</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-concat">concat</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-consoleFunc">consoleFunc</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-doLimit">doLimit</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-doParallel">doParallel</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-doParallelLimit">doParallelLimit</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-doSeries">doSeries</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-getIterator">getIterator</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-initialParams">initialParams</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-iterator">iterator</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-notId">notId</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-once">once</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-onlyOnce">onlyOnce</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-queue">queue</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-reject">reject</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-fallback">fallback</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-wrap">wrap</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-hasNextTick">hasNextTick</a></span></span></li> +<li data-ice="doc"><span data-ice="kind" class="kind-variable">V</span><span data-ice="name"><span><a href="variable/index.html#static-variable-hasSetImmediate">hasSetImmediate</a></span></span></li> +</ul> +</div> +</nav> + +<div class="content" data-ice="content"><h1 data-ice="title">Function</h1> +<div data-ice="summaries"><table class="summary" data-ice="summary"> + <thead><tr><td data-ice="title" colspan="3">Static Public Summary</td></tr></thead> + <tbody> + + <tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-applyEach">applyEach</a></span></span><span data-ice="signature">(eachfn: <span>*</span>): <span>*</span></span> + </p> + </div> + <div> + + + + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-asyncify">asyncify</a></span></span><span data-ice="signature">(func: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Take a sync function and make it async, passing its return value to a +callback.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-auto">auto</a></span></span><span data-ice="signature">(tasks: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>, concurrency: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span>*</span></span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Determines the best order for running the functions in <code>tasks</code>, based on +their requirements.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-autoInject">autoInject</a></span></span><span data-ice="signature">(tasks: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + </p> + </div> + <div> + + + <div data-ice="description"><p>A dependency-injected version of the <span>async.auto</span> function.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-cargo">cargo</a></span></span><span data-ice="signature">(worker: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, payload: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>): <span><a href="typedef/index.html#static-typedef-CargoObject">CargoObject</a></span></span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Creates a <code>cargo</code> object with the specified payload.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-compose">compose</a></span></span><span data-ice="signature">(functions: ...<span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Creates a function which is a composition of the passed asynchronous +functions.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-concat">concat</a></span></span><span data-ice="signature">(eachfn: <span>*</span>, arr: <span>*</span>, fn: <span>*</span>, callback: <span>*</span>)</span> + </p> + </div> + <div> + + + + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-consoleFunc">consoleFunc</a></span></span><span data-ice="signature">(name: <span>*</span>): <span>*</span></span> + </p> + </div> + <div> + + + + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-doDuring">doDuring</a></span></span><span data-ice="signature">(fn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, test: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + </p> + </div> + <div> + + + <div data-ice="description"><p>The post-check version of <span>async.during</span>.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-doLimit">doLimit</a></span></span><span data-ice="signature">(fn: <span>*</span>, limit: <span>*</span>): <span>*</span></span> + </p> + </div> + <div> + + + + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-doParallel">doParallel</a></span></span><span data-ice="signature">(fn: <span>*</span>): <span>*</span></span> + </p> + </div> + <div> + + + + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-doParallelLimit">doParallelLimit</a></span></span><span data-ice="signature">(fn: <span>*</span>): <span>*</span></span> + </p> + </div> + <div> + + + + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-doSeries">doSeries</a></span></span><span data-ice="signature">(fn: <span>*</span>): <span>*</span></span> + </p> + </div> + <div> + + + + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-doUntil">doUntil</a></span></span><span data-ice="signature">(fn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, test: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Like <span>async.doWhilst</span>, except the <code>test</code> is inverted.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-doWhilst">doWhilst</a></span></span><span data-ice="signature">(fn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, test: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + </p> + </div> + <div> + + + <div data-ice="description"><p>The post-check version of <span>async.whilst</span>.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-during">during</a></span></span><span data-ice="signature">(test: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, fn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Like <span>async.whilst</span>, except the <code>test</code> is an asynchronous function that +is passed a callback in the form of <code>function (err, truth)</code>.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-eachLimit">eachLimit</a></span></span><span data-ice="signature">(coll: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>, limit: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, iteratee: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + </p> + </div> + <div> + + + <div data-ice="description"><p>The same as <code>each</code> but runs a maximum of <code>limit</code> async operations at a time.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-eachOfLimit">eachOfLimit</a></span></span><span data-ice="signature">(coll: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>, limit: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, iteratee: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + </p> + </div> + <div> + + + <div data-ice="description"><p>The same as <code>eachOf</code> but runs a maximum of <code>limit</code> async operations at a +time.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-ensureAsync">ensureAsync</a></span></span><span data-ice="signature">(fn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Wrap an async function and ensure it calls its callback on a later tick of +the event loop.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-fallback">fallback</a></span></span><span data-ice="signature">(fn: <span>*</span>)</span> + </p> + </div> + <div> + + + + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-forever">forever</a></span></span><span data-ice="signature">(fn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, errback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Calls the asynchronous function <code>fn</code> with a callback parameter that allows it +to call itself again, in series, indefinitely.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-getIterator">getIterator</a></span></span><span data-ice="signature">(coll: <span>*</span>): <span>*</span></span> + </p> + </div> + <div> + + + + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-initialParams">initialParams</a></span></span><span data-ice="signature">(fn: <span>*</span>): <span>*</span></span> + </p> + </div> + <div> + + + + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-iterator">iterator</a></span></span><span data-ice="signature">(coll: <span>*</span>): <span>*</span></span> + </p> + </div> + <div> + + + + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-iterator">iterator</a></span></span><span data-ice="signature">(tasks: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span>): <span>*</span></span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Creates an iterator function which calls the next function in the <code>tasks</code> +array, returning a continuation to call the next one after that.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-mapValuesLimit">mapValuesLimit</a></span></span><span data-ice="signature">(obj: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>, limit: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, iteratee: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + </p> + </div> + <div> + + + <div data-ice="description"><p>The same as <code>mapValues</code> but runs a maximum of <code>limit</code> async operations at a +time.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-memoize">memoize</a></span></span><span data-ice="signature">(fn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, hasher: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Caches the results of an <code>async</code> function.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-notId">notId</a></span></span><span data-ice="signature">(v: <span>*</span>): <span>*</span></span> + </p> + </div> + <div> + + + + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-once">once</a></span></span><span data-ice="signature">(fn: <span>*</span>): <span>*</span></span> + </p> + </div> + <div> + + + + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-onlyOnce">onlyOnce</a></span></span><span data-ice="signature">(fn: <span>*</span>): <span>*</span></span> + </p> + </div> + <div> + + + + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-parallelLimit">parallelLimit</a></span></span><span data-ice="signature">(tasks: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span>Collection</span>, limit: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + </p> + </div> + <div> + + + <div data-ice="description"><p>The same as <code>parallel</code> but runs a maximum of <code>limit</code> async operations at a +time.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-priorityQueue">priorityQueue</a></span></span><span data-ice="signature">(worker: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, concurrency: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>): <span><a href="function/index.html#static-function-queue">queue</a></span></span> + </p> + </div> + <div> + + + <div data-ice="description"><p>The same as <span>async.queue</span> only tasks are assigned a priority and +completed in ascending priority order.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-queue">queue</a></span></span><span data-ice="signature">(worker: <span>*</span>, concurrency: <span>*</span>, payload: <span>*</span>): <span>*</span></span> + </p> + </div> + <div> + + + + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-queue">queue</a></span></span><span data-ice="signature">(worker: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, concurrency: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>): <span><a href="typedef/index.html#static-typedef-QueueObject">QueueObject</a></span></span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Creates a <code>queue</code> object with the specified <code>concurrency</code>.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-race">race</a></span></span><span data-ice="signature">(tasks: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span>*</span></span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Runs the <code>tasks</code> array of functions in parallel, without waiting until the +previous function has completed.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-reduce">reduce</a></span></span><span data-ice="signature">(coll: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>, memo: <span>*</span>, iteratee: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Reduces <code>coll</code> into a single value using an async <code>iteratee</code> to return each +successive step.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-reduceRight">reduceRight</a></span></span><span data-ice="signature">(coll: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>, memo: <span>*</span>, iteratee: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Same as <code>reduce</code>, only operates on <code>coll</code> in reverse order.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-reflect">reflect</a></span></span><span data-ice="signature">(fn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Wraps the function in another function that always returns data even when it +errors.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-reflectAll">reflectAll</a></span></span><span data-ice="signature">(tasks: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span></span> + </p> + </div> + <div> + + + <div data-ice="description"><p>A helper function that wraps an array of functions with reflect.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-reject">reject</a></span></span><span data-ice="signature">(eachfn: <span>*</span>, arr: <span>*</span>, iteratee: <span>*</span>, callback: <span>*</span>)</span> + </p> + </div> + <div> + + + + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-retry">retry</a></span></span><span data-ice="signature">(opts: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, task: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Attempts to get a successful response from <code>task</code> no more than <code>times</code> times +before returning an error.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-retryable">retryable</a></span></span><span data-ice="signature">(opts: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, task: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span>Functions</span></span> + </p> + </div> + <div> + + + <div data-ice="description"><p>A close relative of <code>retry</code>.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-series">series</a></span></span><span data-ice="signature">(tasks: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Run the functions in the <code>tasks</code> collection in series, each one running once +the previous function has completed.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-sortBy">sortBy</a></span></span><span data-ice="signature">(coll: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>, iteratee: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Sorts a list by the results of running each <code>coll</code> value through an async +<code>iteratee</code>.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-timeLimit">timeLimit</a></span></span><span data-ice="signature">(count: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, limit: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, iteratee: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + </p> + </div> + <div> + + + <div data-ice="description"><p>The same as <span>times</span> but runs a maximum of <code>limit</code> async operations at a +time.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-timeout">timeout</a></span></span><span data-ice="signature">(asyncFn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, milliseconds: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, info: <span>*</span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Sets a time limit on an asynchronous function.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-transform">transform</a></span></span><span data-ice="signature">(coll: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>, accumulator: <span>*</span>, iteratee: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + </p> + </div> + <div> + + + <div data-ice="description"><p>A relative of <code>reduce</code>.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-unmemoize">unmemoize</a></span></span><span data-ice="signature">(fn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Undoes a <span>async.memoize</span>d function, reverting it to the original, +unmemoized form.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-until">until</a></span></span><span data-ice="signature">(test: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, fn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Repeatedly call <code>fn</code> until <code>test</code> returns <code>true</code>.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-waterfall">waterfall</a></span></span><span data-ice="signature">(tasks: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span>*</span></span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Runs the <code>tasks</code> array of functions in series, each passing their results to +the next in the array.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-whilst">whilst</a></span></span><span data-ice="signature">(test: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, iteratee: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span>*</span></span> + </p> + </div> + <div> + + + <div data-ice="description"><p>Repeatedly call <code>fn</code>, while <code>test</code> returns <code>true</code>.</p> +</div> + </div> + </td> + <td> + + + </td> + </tr> +<tr data-ice="target"> + <td> + <span class="access" data-ice="access">public</span> + + + + <span class="override" data-ice="override"></span> + </td> + <td> + <div> + <p> + <span data-ice="name"><span><a href="function/index.html#static-function-wrap">wrap</a></span></span><span data-ice="signature">(defer: <span>*</span>): <span>*</span></span> + </p> + </div> + <div> + + + + </div> + </td> + <td> + + + </td> + </tr> +</tbody> +</table> +</div> +<div data-ice="details"><h2 data-ice="title">Static Public </h2> + +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-applyEach"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">applyEach</span><span data-ice="signature">(eachfn: <span>*</span>): <span>*</span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/internal/applyEach.js.html#lineNumber4">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import applyEach from '<span><a href="file/lib/internal/applyEach.js.html#lineNumber4">async/lib/internal/applyEach.js</a></span>'</code></pre></div> + + + + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">eachfn</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span>*</span></td> + + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-asyncify"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">asyncify</span><span data-ice="signature">(func: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/asyncify.js.html#lineNumber58">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import asyncify from '<span><a href="file/lib/asyncify.js.html#lineNumber58">async/lib/asyncify.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Take a sync function and make it async, passing its return value to a +callback. This is useful for plugging sync functions into a waterfall, +series, or other async functions. Any arguments passed to the generated +function will be passed to the wrapped function (except for the final +callback argument). Errors thrown will be passed to the callback.</p> +<p>If the function passed to <code>asyncify</code> returns a Promise, that promises's +resolved/rejected state will be used to call the callback, rather than simply +the synchronous return value.</p> +<p>This also means you can asyncify ES2016 <code>async</code> functions.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">func</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>The synchronous function to convert to an +asynchronous function.</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td class="return-desc" data-ice="returnDescription"><p>An asynchronous wrapper of the <code>func</code>. To be invoked with +(callback).</p> +</td> + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +// passing a regular synchronous function +async.waterfall([ + async.apply(fs.readFile, filename, "utf8"), + async.asyncify(JSON.parse), + function (data, next) { + // data is the result of parsing the text. + // If there was a parsing error, it would have been caught. + } +], callback); + +// passing a function returning a promise +async.waterfall([ + async.apply(fs.readFile, filename, "utf8"), + async.asyncify(function (contents) { + return db.model.create(contents); + }), + function (model, next) { + // `model` is the instantiated model object. + // If there was an error, this function would be skipped. + } +], callback); + +// es6 example +var q = async.queue(async.asyncify(async function(file) { + var intermediateStep = await processFile(file); + return await somePromise(intermediateStep) +})); + +q.push(files);</code></pre> + </div> +</div> + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-auto"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">auto</span><span data-ice="signature">(tasks: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>, concurrency: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span>*</span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/auto.js.html#lineNumber90">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import auto from '<span><a href="file/lib/auto.js.html#lineNumber90">async/lib/auto.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Determines the best order for running the functions in <code>tasks</code>, based on +their requirements. Each function can optionally depend on other functions +being completed first, and each function is run as soon as its requirements +are satisfied.</p> +<p>If any of the functions pass an error to their callback, the <code>auto</code> sequence +will stop. Further tasks will not execute (so any other functions depending +on it will not run), and the main <code>callback</code> is immediately called with the +error.</p> +<p>Functions also receive an object containing the results of functions which +have completed so far as the first argument, if they have dependencies. If a +task function has no dependencies, it will only be passed a callback.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">tasks</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>An object. Each of its properties is either a +function or an array of requirements, with the function itself the last item +in the array. The object's key of a property serves as the name of the task +defined by that property, i.e. can be used when specifying requirements for +other tasks. The function receives one or two arguments:</p> +<ul> +<li>a <code>results</code> object, containing the results of the previously executed +functions, only passed if the task has any dependencies,</li> +<li>a <code>callback(err, result)</code> function, which must be called when finished, +passing an <code>error</code> (which can be <code>null</code>) and the result of the function's +execution.</li> +</ul> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">concurrency</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span></td> + <td data-ice="appendix"><ul><li>optional</li> +<li>default: Infinity</li></ul></td> + <td data-ice="description"><p>An optional <code>integer</code> for +determining the maximum number of tasks that can be run in parallel. By +default, as many as possible.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>An optional callback which is called when all +the tasks have been completed. It receives the <code>err</code> argument if any <code>tasks</code> +pass an error to their callback. Results are always returned; however, if an +error occurs, no further <code>tasks</code> will be performed, and the results object +will only contain partial results. Invoked with (err, results).</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span>*</span></td> + <td class="return-desc" data-ice="returnDescription"><p>undefined</p> +</td> + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +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 + // ... + }] +}, callback); + +async.auto({ + get_data: function(callback) { + console.log('in get_data'); + // async code to get some data + callback(null, 'data', 'converted to array'); + }, + make_folder: function(callback) { + console.log('in make_folder'); + // async code to create a directory to store a file in + // this is run at the same time as getting the data + callback(null, 'folder'); + }, + write_file: ['get_data', 'make_folder', function(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); + console.log('results = ', results); +});</code></pre> + </div> +</div> + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-autoInject"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">autoInject</span><span data-ice="signature">(tasks: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/autoInject.js.html#lineNumber100">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import autoInject from '<span><a href="file/lib/autoInject.js.html#lineNumber100">async/lib/autoInject.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>A dependency-injected version of the <span>async.auto</span> function. Dependent +tasks are specified as parameters to the function, after the usual callback +parameter, with the parameter names matching the names of the tasks it +depends on. This can provide even more readable task graphs which can be +easier to maintain.</p> +<p>If a final callback is specified, the task results are similarly injected, +specified as named parameters after the initial error parameter.</p> +<p>The autoInject function is purely syntactic sugar and its semantics are +otherwise equivalent to <span>async.auto</span>.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">tasks</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>An object, each of whose properties is a function of +the form 'func([dependencies...], callback). The object's key of a property +serves as the name of the task defined by that property, i.e. can be used +when specifying requirements for other tasks.</p> +<ul> +<li>The <code>callback</code> parameter is a <code>callback(err, result)</code> which must be called +when finished, passing an <code>error</code> (which can be <code>null</code>) and the result of +the function's execution. The remaining parameters name other tasks on +which the task is dependent, and the results from those tasks are the +arguments of those parameters.</li> +</ul> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>An optional callback which is called when all +the tasks have been completed. It receives the <code>err</code> argument if any <code>tasks</code> +pass an error to their callback. The remaining parameters are task names +whose results you are interested in. This callback will only be called when +all tasks have finished or an error has occurred, and so do not specify +dependencies in the same way as <code>tasks</code> do. If an error occurs, no further +<code>tasks</code> will be performed, and <code>results</code> will only be valid for those tasks +which managed to complete. Invoked with (err, [results...]).</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +// The example from `auto` can be rewritten as follows: +async.autoInject({ + 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: function(get_data, make_folder, callback) { + // once there is some data and the directory exists, + // write the data to a file in the directory + callback(null, 'filename'); + }, + email_link: function(write_file, callback) { + // once the file is written let's email a link to it... + // write_file contains the filename returned by write_file. + callback(null, {'file':write_file, 'email':'user@example.com'}); + } +}, function(err, email_link) { + console.log('err = ', err); + console.log('email_link = ', email_link); +}); + +// If you are using a JS minifier that mangles parameter names, `autoInject` +// will not work with plain functions, since the parameter names will be +// collapsed to a single letter identifier. To work around this, you can +// explicitly specify the names of the parameters your task function needs +// in an array, similar to Angular.js dependency injection. The final +// results callback can be provided as an array in the same way. + +// This still has an advantage over plain `auto`, since the results a task +// depends on are still spread into arguments. +async.autoInject({ + //... + write_file: ['get_data', 'make_folder', function(get_data, make_folder, callback) { + callback(null, 'filename'); + }], + email_link: ['write_file', function(write_file, callback) { + callback(null, {'file':write_file, 'email':'user@example.com'}); + }] + //... +}, ['email_link', function(err, email_link) { + console.log('err = ', err); + console.log('email_link = ', email_link); +}]);</code></pre> + </div> +</div> + + + + <div data-ice="see"><h4>See:</h4><ul><li><span><a href="async.auto">async.auto</a></span></li></ul></div> + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-cargo"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">cargo</span><span data-ice="signature">(worker: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, payload: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>): <span><a href="typedef/index.html#static-typedef-CargoObject">CargoObject</a></span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/cargo.js.html#lineNumber79">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import cargo from '<span><a href="file/lib/cargo.js.html#lineNumber79">async/lib/cargo.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Creates a <code>cargo</code> object with the specified payload. Tasks added to the +cargo will be processed altogether (up to the <code>payload</code> limit). If the +<code>worker</code> is in progress, the task is queued until it becomes available. Once +the <code>worker</code> has completed some tasks, each callback of those tasks is +called. Check out <a href="https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966">these</a> <a href="https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966">animations</a> +for how <code>cargo</code> and <code>queue</code> work.</p> +<p>While <a href="#queue">queue</a> passes only one task to one of a group of workers +at a time, cargo passes an array of tasks to a single worker, repeating +when the worker is finished.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">worker</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>An asynchronous function for processing an array +of queued tasks, which must call its <code>callback(err)</code> argument when finished, +with an optional <code>err</code> argument. Invoked with (tasks, callback).</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">payload</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span></td> + <td data-ice="appendix"><ul><li>optional</li> +<li>default: Infinity</li></ul></td> + <td data-ice="description"><p>An optional <code>integer</code> for determining +how many tasks should be processed per round; if omitted, the default is +unlimited.</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span><a href="typedef/index.html#static-typedef-CargoObject">CargoObject</a></span></td> + <td class="return-desc" data-ice="returnDescription"><p>A cargo object to manage the tasks. Callbacks can +attached as certain properties to listen for specific events during the +lifecycle of the cargo and inner queue.</p> +</td> + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +// create a cargo object with payload 2 +var cargo = async.cargo(function(tasks, callback) { + for (var i=0; i<tasks.length; i++) { + console.log('hello ' + tasks[i].name); + } + callback(); +}, 2); + +// add some items +cargo.push({name: 'foo'}, function(err) { + console.log('finished processing foo'); +}); +cargo.push({name: 'bar'}, function(err) { + console.log('finished processing bar'); +}); +cargo.push({name: 'baz'}, function(err) { + console.log('finished processing baz'); +});</code></pre> + </div> +</div> + + + + <div data-ice="see"><h4>See:</h4><ul><li><span><a href="async.queue">async.queue</a></span></li></ul></div> + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-compose"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">compose</span><span data-ice="signature">(functions: ...<span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/compose.js.html#lineNumber39">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import compose from '<span><a href="file/lib/compose.js.html#lineNumber39">async/lib/compose.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Creates a function which is a composition of the passed asynchronous +functions. Each function consumes the return value of the function that +follows. Composing functions <code>f()</code>, <code>g()</code>, and <code>h()</code> would produce the result +of <code>f(g(h()))</code>, only this version uses callbacks to obtain the return values.</p> +<p>Each function is executed with the <code>this</code> binding of the composed function.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">functions</td> + <td data-ice="type">...<span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>the asynchronous functions to compose</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td class="return-desc" data-ice="returnDescription"><p>an asynchronous function that is the composed +asynchronous <code>functions</code></p> +</td> + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +function add1(n, callback) { + setTimeout(function () { + callback(null, n + 1); + }, 10); +} + +function mul3(n, callback) { + setTimeout(function () { + callback(null, n * 3); + }, 10); +} + +var add1mul3 = async.compose(mul3, add1); +add1mul3(4, function (err, result) { + // result now equals 15 +});</code></pre> + </div> +</div> + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-concat"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">concat</span><span data-ice="signature">(eachfn: <span>*</span>, arr: <span>*</span>, fn: <span>*</span>, callback: <span>*</span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/internal/concat.js.html#lineNumber1">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import concat from '<span><a href="file/lib/internal/concat.js.html#lineNumber1">async/lib/internal/concat.js</a></span>'</code></pre></div> + + + + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">eachfn</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">arr</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">fn</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-consoleFunc"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">consoleFunc</span><span data-ice="signature">(name: <span>*</span>): <span>*</span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/internal/consoleFunc.js.html#lineNumber4">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import consoleFunc from '<span><a href="file/lib/internal/consoleFunc.js.html#lineNumber4">async/lib/internal/consoleFunc.js</a></span>'</code></pre></div> + + + + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">name</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span>*</span></td> + + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-doDuring"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">doDuring</span><span data-ice="signature">(fn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, test: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/doDuring.js.html#lineNumber23">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import doDuring from '<span><a href="file/lib/doDuring.js.html#lineNumber23">async/lib/doDuring.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>The post-check version of <span>async.during</span>. To reflect the difference in +the order of operations, the arguments <code>test</code> and <code>fn</code> are switched.</p> +<p>Also a version of <span>async.doWhilst</span> with asynchronous <code>test</code> function.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">fn</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A function which is called each time <code>test</code> passes. +The function is passed a <code>callback(err)</code>, which must be called once it has +completed with an optional <code>err</code> argument. Invoked with (callback).</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">test</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>asynchronous truth test to perform before each +execution of <code>fn</code>. Invoked with (callback).</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>A callback which is called after the test +function has failed and repeated execution of <code>fn</code> has stopped. <code>callback</code> +will be passed an error and any arguments passed to the final <code>fn</code>'s +callback. Invoked with (err, [results]);</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + + + + + <div data-ice="see"><h4>See:</h4><ul><li><span><a href="async.during">async.during</a></span></li></ul></div> + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-doLimit"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">doLimit</span><span data-ice="signature">(fn: <span>*</span>, limit: <span>*</span>): <span>*</span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/internal/doLimit.js.html#lineNumber1">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import doLimit from '<span><a href="file/lib/internal/doLimit.js.html#lineNumber1">async/lib/internal/doLimit.js</a></span>'</code></pre></div> + + + + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">fn</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">limit</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span>*</span></td> + + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-doParallel"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">doParallel</span><span data-ice="signature">(fn: <span>*</span>): <span>*</span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/internal/doParallel.js.html#lineNumber3">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import doParallel from '<span><a href="file/lib/internal/doParallel.js.html#lineNumber3">async/lib/internal/doParallel.js</a></span>'</code></pre></div> + + + + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">fn</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span>*</span></td> + + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-doParallelLimit"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">doParallelLimit</span><span data-ice="signature">(fn: <span>*</span>): <span>*</span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/internal/doParallelLimit.js.html#lineNumber3">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import doParallelLimit from '<span><a href="file/lib/internal/doParallelLimit.js.html#lineNumber3">async/lib/internal/doParallelLimit.js</a></span>'</code></pre></div> + + + + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">fn</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span>*</span></td> + + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-doSeries"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">doSeries</span><span data-ice="signature">(fn: <span>*</span>): <span>*</span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/internal/doSeries.js.html#lineNumber3">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import doSeries from '<span><a href="file/lib/internal/doSeries.js.html#lineNumber3">async/lib/internal/doSeries.js</a></span>'</code></pre></div> + + + + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">fn</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span>*</span></td> + + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-doUntil"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">doUntil</span><span data-ice="signature">(fn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, test: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/doUntil.js.html#lineNumber22">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import doUntil from '<span><a href="file/lib/doUntil.js.html#lineNumber22">async/lib/doUntil.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Like <span>async.doWhilst</span>, except the <code>test</code> is inverted. Note the +argument ordering differs from <code>until</code>.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">fn</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A function which is called each time <code>test</code> fails. +The function is passed a <code>callback(err)</code>, which must be called once it has +completed with an optional <code>err</code> argument. Invoked with (callback).</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">test</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>synchronous truth test to perform after each +execution of <code>fn</code>. Invoked with the non-error callback results of <code>fn</code>.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>A callback which is called after the test +function has passed and repeated execution of <code>fn</code> has stopped. <code>callback</code> +will be passed an error and any arguments passed to the final <code>fn</code>'s +callback. Invoked with (err, [results]);</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + + + + + <div data-ice="see"><h4>See:</h4><ul><li><span><a href="async.doWhilst">async.doWhilst</a></span></li></ul></div> + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-doWhilst"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">doWhilst</span><span data-ice="signature">(fn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, test: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/doWhilst.js.html#lineNumber25">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import doWhilst from '<span><a href="file/lib/doWhilst.js.html#lineNumber25">async/lib/doWhilst.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>The post-check version of <span>async.whilst</span>. To reflect the difference in +the order of operations, the arguments <code>test</code> and <code>fn</code> are switched.</p> +<p><code>doWhilst</code> is to <code>whilst</code> as <code>do while</code> is to <code>while</code> in plain JavaScript.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">fn</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A function which is called each time <code>test</code> passes. +The function is passed a <code>callback(err)</code>, which must be called once it has +completed with an optional <code>err</code> argument. Invoked with (callback).</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">test</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>synchronous truth test to perform after each +execution of <code>fn</code>. Invoked with Invoked with the non-error callback results +of <code>fn</code>.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>A callback which is called after the test +function has failed and repeated execution of <code>fn</code> has stopped. <code>callback</code> +will be passed an error and any arguments passed to the final <code>fn</code>'s +callback. Invoked with (err, [results]);</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + + + + + <div data-ice="see"><h4>See:</h4><ul><li><span><a href="async.whilst">async.whilst</a></span></li></ul></div> + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-during"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">during</span><span data-ice="signature">(test: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, fn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/during.js.html#lineNumber41">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import during from '<span><a href="file/lib/during.js.html#lineNumber41">async/lib/during.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Like <span>async.whilst</span>, except the <code>test</code> is an asynchronous function that +is passed a callback in the form of <code>function (err, truth)</code>. If error is +passed to <code>test</code> or <code>fn</code>, the main callback is immediately called with the +value of the error.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">test</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>asynchronous truth test to perform before each +execution of <code>fn</code>. Invoked with (callback).</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">fn</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A function which is called each time <code>test</code> passes. +The function is passed a <code>callback(err)</code>, which must be called once it has +completed with an optional <code>err</code> argument. Invoked with (callback).</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>A callback which is called after the test +function has failed and repeated execution of <code>fn</code> has stopped. <code>callback</code> +will be passed an error and any arguments passed to the final <code>fn</code>'s +callback. Invoked with (err, [results]);</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +var count = 0; + +async.during( + function (callback) { + return callback(null, count < 5); + }, + function (callback) { + count++; + setTimeout(callback, 1000); + }, + function (err) { + // 5 seconds have passed + } +);</code></pre> + </div> +</div> + + + + <div data-ice="see"><h4>See:</h4><ul><li><span><a href="async.whilst">async.whilst</a></span></li></ul></div> + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-eachLimit"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">eachLimit</span><span data-ice="signature">(coll: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>, limit: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, iteratee: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/eachLimit.js.html#lineNumber24">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import eachLimit from '<span><a href="file/lib/eachLimit.js.html#lineNumber24">async/lib/eachLimit.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>The same as <code>each</code> but runs a maximum of <code>limit</code> async operations at a time.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">coll</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A colleciton to iterate over.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">limit</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>The maximum number of async operations at a time.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">iteratee</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A function to apply to each item in <code>coll</code>. The +iteratee is passed a <code>callback(err)</code> which must be called once it has +completed. If no error has occurred, the <code>callback</code> should be run without +arguments or with an explicit <code>null</code> argument. The array index is not passed +to the iteratee. Invoked with (item, callback). If you need the index, use +<code>eachOfLimit</code>.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>A callback which is called when all +<code>iteratee</code> functions have finished, or an error occurs. Invoked with (err).</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + + + + + <div data-ice="see"><h4>See:</h4><ul><li><span><a href="async.each">async.each</a></span></li></ul></div> + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-eachOfLimit"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">eachOfLimit</span><span data-ice="signature">(coll: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>, limit: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, iteratee: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/eachOfLimit.js.html#lineNumber24">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import eachOfLimit from '<span><a href="file/lib/eachOfLimit.js.html#lineNumber24">async/lib/eachOfLimit.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>The same as <code>eachOf</code> but runs a maximum of <code>limit</code> async operations at a +time.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">coll</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A collection to iterate over.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">limit</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>The maximum number of async operations at a time.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">iteratee</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A function to apply to each +item in <code>coll</code>. The <code>key</code> is the item's key, or index in the case of an +array. The iteratee is passed a <code>callback(err)</code> which must be called once it +has completed. If no error has occurred, the callback should be run without +arguments or with an explicit <code>null</code> argument. Invoked with +(item, key, callback).</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>A callback which is called when all +<code>iteratee</code> functions have finished, or an error occurs. Invoked with (err).</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + + + + + <div data-ice="see"><h4>See:</h4><ul><li><span><a href="async.eachOf">async.eachOf</a></span></li></ul></div> + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-ensureAsync"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">ensureAsync</span><span data-ice="signature">(fn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/ensureAsync.js.html#lineNumber37">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import ensureAsync from '<span><a href="file/lib/ensureAsync.js.html#lineNumber37">async/lib/ensureAsync.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Wrap an async function and ensure it calls its callback on a later tick of +the event loop. If the function already calls its callback on a next tick, +no extra deferral is added. This is useful for preventing stack overflows +(<code>RangeError: Maximum call stack size exceeded</code>) and generally keeping +<a href="http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony">Zalgo</a> +contained.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">fn</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>an async function, one that expects a node-style +callback as its last argument.</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td class="return-desc" data-ice="returnDescription"><p>Returns a wrapped function with the exact same call +signature as the function passed in.</p> +</td> + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +function sometimesAsync(arg, callback) { + if (cache[arg]) { + return callback(null, cache[arg]); // this would be synchronous!! + } else { + doSomeIO(arg, callback); // this IO would be asynchronous + } +} + +// this has a risk of stack overflows if many results are cached in a row +async.mapSeries(args, sometimesAsync, done); + +// this will defer sometimesAsync's callback if necessary, +// preventing stack overflows +async.mapSeries(args, async.ensureAsync(sometimesAsync), done);</code></pre> + </div> +</div> + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-fallback"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">fallback</span><span data-ice="signature">(fn: <span>*</span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/internal/setImmediate.js.html#lineNumber8">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import {fallback} from '<span><a href="file/lib/internal/setImmediate.js.html#lineNumber8">async/lib/internal/setImmediate.js</a></span>'</code></pre></div> + + + + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">fn</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-forever"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">forever</span><span data-ice="signature">(fn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, errback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/forever.js.html#lineNumber34">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import forever from '<span><a href="file/lib/forever.js.html#lineNumber34">async/lib/forever.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Calls the asynchronous function <code>fn</code> with a callback parameter that allows it +to call itself again, in series, indefinitely.</p> +<p>If an error is passed to the +callback then <code>errback</code> is called with the error, and execution stops, +otherwise it will never be called.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">fn</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>a function to call repeatedly. Invoked with (next).</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">errback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>when <code>fn</code> passes an error to it's callback, +this function will be called, and execution stops. Invoked with (err).</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +async.forever( + function(next) { + // next is suitable for passing to things that need a callback(err [, whatever]); + // it will result in this function being called again. + }, + function(err) { + // if next is called with a value in its first parameter, it will appear + // in here as 'err', and execution will stop. + } +);</code></pre> + </div> +</div> + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-getIterator"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">getIterator</span><span data-ice="signature">(coll: <span>*</span>): <span>*</span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/internal/getIterator.js.html#lineNumber3">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import getIterator from '<span><a href="file/lib/internal/getIterator.js.html#lineNumber3">async/lib/internal/getIterator.js</a></span>'</code></pre></div> + + + + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">coll</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span>*</span></td> + + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-initialParams"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">initialParams</span><span data-ice="signature">(fn: <span>*</span>): <span>*</span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/internal/initialParams.js.html#lineNumber3">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import initialParams from '<span><a href="file/lib/internal/initialParams.js.html#lineNumber3">async/lib/internal/initialParams.js</a></span>'</code></pre></div> + + + + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">fn</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span>*</span></td> + + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-iterator"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">iterator</span><span data-ice="signature">(coll: <span>*</span>): <span>*</span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/internal/iterator.js.html#lineNumber5">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import iterator from '<span><a href="file/lib/internal/iterator.js.html#lineNumber5">async/lib/internal/iterator.js</a></span>'</code></pre></div> + + + + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">coll</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span>*</span></td> + + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-iterator"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">iterator</span><span data-ice="signature">(tasks: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span>): <span>*</span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/iterator.js.html#lineNumber33">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import iterator from '<span><a href="file/lib/iterator.js.html#lineNumber33">async/lib/iterator.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Creates an iterator function which calls the next function in the <code>tasks</code> +array, returning a continuation to call the next one after that. It's also +possible to “peek” at the next iterator with <code>iterator.next()</code>.</p> +<p>This function is used internally by the <code>async</code> module, but can be useful +when you want to manually control the flow of functions in series.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">tasks</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>An array of functions to run.</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span>*</span></td> + <td class="return-desc" data-ice="returnDescription"><p>The next function to run in the series.</p> +</td> + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +var iterator = async.iterator([ + function() { sys.p('one'); }, + function() { sys.p('two'); }, + function() { sys.p('three'); } +]); + +node> var iterator2 = iterator(); +'one' +node> var iterator3 = iterator2(); +'two' +node> iterator3(); +'three' +node> var nextfn = iterator2.next(); +node> nextfn(); +'three'</code></pre> + </div> +</div> + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-mapValuesLimit"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">mapValuesLimit</span><span data-ice="signature">(obj: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>, limit: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, iteratee: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/mapValuesLimit.js.html#lineNumber22">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import mapValuesLimit from '<span><a href="file/lib/mapValuesLimit.js.html#lineNumber22">async/lib/mapValuesLimit.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>The same as <code>mapValues</code> but runs a maximum of <code>limit</code> async operations at a +time.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">obj</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A collection to iterate over.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">limit</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>The maximum number of async operations at a time.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">iteratee</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A function to apply to each value in <code>obj</code>. +The iteratee is passed a <code>callback(err, transformed)</code> which must be called +once it has completed with an error (which can be <code>null</code>) and a +transformed value. Invoked with (value, key, callback).</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>A callback which is called when all <code>iteratee</code> +functions have finished, or an error occurs. Result is an object of the +transformed values from the <code>obj</code>. Invoked with (err, result).</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + + + + + <div data-ice="see"><h4>See:</h4><ul><li><span><a href="async.mapValues">async.mapValues</a></span></li></ul></div> + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-memoize"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">memoize</span><span data-ice="signature">(fn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, hasher: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/memoize.js.html#lineNumber47">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import memoize from '<span><a href="file/lib/memoize.js.html#lineNumber47">async/lib/memoize.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Caches the results of an <code>async</code> function. When creating a hash to store +function results against, the callback is omitted from the hash and an +optional hash function can be used.</p> +<p>If no hash function is specified, the first argument is used as a hash key, +which may work reasonably if it is a string or a data type that converts to a +distinct string. Note that objects and arrays will not behave reasonably. +Neither will cases where the other arguments are significant. In such cases, +specify your own hash function.</p> +<p>The cache of results is exposed as the <code>memo</code> property of the function +returned by <code>memoize</code>.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">fn</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>The function to proxy and cache results from.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">hasher</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>An optional function for generating a custom hash +for storing results. It has all the arguments applied to it apart from the +callback, and must be synchronous.</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td class="return-desc" data-ice="returnDescription"><p>a memoized version of <code>fn</code></p> +</td> + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +var slow_fn = function(name, callback) { + // do something + callback(null, result); +}; +var fn = async.memoize(slow_fn); + +// fn can now be used as if it were slow_fn +fn('some name', function() { + // callback +});</code></pre> + </div> +</div> + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-notId"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">notId</span><span data-ice="signature">(v: <span>*</span>): <span>*</span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/internal/notId.js.html#lineNumber1">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import notId from '<span><a href="file/lib/internal/notId.js.html#lineNumber1">async/lib/internal/notId.js</a></span>'</code></pre></div> + + + + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">v</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span>*</span></td> + + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-once"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">once</span><span data-ice="signature">(fn: <span>*</span>): <span>*</span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/internal/once.js.html#lineNumber1">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import once from '<span><a href="file/lib/internal/once.js.html#lineNumber1">async/lib/internal/once.js</a></span>'</code></pre></div> + + + + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">fn</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span>*</span></td> + + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-onlyOnce"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">onlyOnce</span><span data-ice="signature">(fn: <span>*</span>): <span>*</span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/internal/onlyOnce.js.html#lineNumber1">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import onlyOnce from '<span><a href="file/lib/internal/onlyOnce.js.html#lineNumber1">async/lib/internal/onlyOnce.js</a></span>'</code></pre></div> + + + + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">fn</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span>*</span></td> + + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-parallelLimit"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">parallelLimit</span><span data-ice="signature">(tasks: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span>Collection</span>, limit: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/parallelLimit.js.html#lineNumber23">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import parallelLimit from '<span><a href="file/lib/parallelLimit.js.html#lineNumber23">async/lib/parallelLimit.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>The same as <code>parallel</code> but runs a maximum of <code>limit</code> async operations at a +time.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">tasks</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span>Collection</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A collection containing functions to run. +Each function is passed a <code>callback(err, result)</code> which it must call on +completion with an error <code>err</code> (which can be <code>null</code>) and an optional <code>result</code> +value.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">limit</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>The maximum number of async operations at a time.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>An optional callback to run once all the +functions have completed successfully. This function gets a results array +(or object) containing all the result arguments passed to the task callbacks. +Invoked with (err, results).</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + + + + + <div data-ice="see"><h4>See:</h4><ul><li><span><a href="async.parallel">async.parallel</a></span></li></ul></div> + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-priorityQueue"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">priorityQueue</span><span data-ice="signature">(worker: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, concurrency: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>): <span><a href="function/index.html#static-function-queue">queue</a></span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/priorityQueue.js.html#lineNumber32">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import priorityQueue from '<span><a href="file/lib/priorityQueue.js.html#lineNumber32">async/lib/priorityQueue.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>The same as <span>async.queue</span> only tasks are assigned a priority and +completed in ascending priority order.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">worker</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>An asynchronous function for processing a queued +task, which must call its <code>callback(err)</code> argument when finished, with an +optional <code>error</code> as an argument. If you want to handle errors from an +individual task, pass a callback to <code>q.push()</code>. Invoked with +(task, callback).</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">concurrency</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>An <code>integer</code> for determining how many <code>worker</code> +functions should be run in parallel. If omitted, the concurrency defaults to +<code>1</code>. If the concurrency is <code>0</code>, an error is thrown.</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span><a href="function/index.html#static-function-queue">queue</a></span></td> + <td class="return-desc" data-ice="returnDescription"><p>A priorityQueue object to manage the tasks. There are two +differences between <code>queue</code> and <code>priorityQueue</code> objects:</p> +<ul> +<li><code>push(task, priority, [callback])</code> - <code>priority</code> should be a number. If an +array of <code>tasks</code> is given, all tasks will be assigned the same priority.</li> +<li>The <code>unshift</code> method was removed.</li> +</ul> +</td> + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + + + + + <div data-ice="see"><h4>See:</h4><ul><li><span><a href="async.queue">async.queue</a></span></li></ul></div> + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-queue"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">queue</span><span data-ice="signature">(worker: <span>*</span>, concurrency: <span>*</span>, payload: <span>*</span>): <span>*</span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/internal/queue.js.html#lineNumber10">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import queue from '<span><a href="file/lib/internal/queue.js.html#lineNumber10">async/lib/internal/queue.js</a></span>'</code></pre></div> + + + + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">worker</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">concurrency</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">payload</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span>*</span></td> + + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-queue"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">queue</span><span data-ice="signature">(worker: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, concurrency: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>): <span><a href="typedef/index.html#static-typedef-QueueObject">QueueObject</a></span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/queue.js.html#lineNumber101">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import queue from '<span><a href="file/lib/queue.js.html#lineNumber101">async/lib/queue.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Creates a <code>queue</code> object with the specified <code>concurrency</code>. Tasks added to the +<code>queue</code> are processed in parallel (up to the <code>concurrency</code> limit). If all +<code>worker</code>s are in progress, the task is queued until one becomes available. +Once a <code>worker</code> completes a <code>task</code>, that <code>task</code>'s callback is called.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">worker</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>An asynchronous function for processing a queued +task, which must call its <code>callback(err)</code> argument when finished, with an +optional <code>error</code> as an argument. If you want to handle errors from an +individual task, pass a callback to <code>q.push()</code>. Invoked with +(task, callback).</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">concurrency</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span></td> + <td data-ice="appendix"><ul><li>optional</li> +<li>default: 1</li></ul></td> + <td data-ice="description"><p>An <code>integer</code> for determining how many +<code>worker</code> functions should be run in parallel. If omitted, the concurrency +defaults to <code>1</code>. If the concurrency is <code>0</code>, an error is thrown.</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span><a href="typedef/index.html#static-typedef-QueueObject">QueueObject</a></span></td> + <td class="return-desc" data-ice="returnDescription"><p>A queue object to manage the tasks. Callbacks can +attached as certain properties to listen for specific events during the +lifecycle of the queue.</p> +</td> + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +// create a queue object with concurrency 2 +var q = async.queue(function(task, callback) { + console.log('hello ' + task.name); + callback(); +}, 2); + +// assign a callback +q.drain = function() { + console.log('all items have been processed'); +}; + +// add some items to the queue +q.push({name: 'foo'}, function(err) { + console.log('finished processing foo'); +}); +q.push({name: 'bar'}, function (err) { + console.log('finished processing bar'); +}); + +// add some items to the queue (batch-wise) +q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function(err) { + console.log('finished processing item'); +}); + +// add some items to the front of the queue +q.unshift({name: 'bar'}, function (err) { + console.log('finished processing bar'); +});</code></pre> + </div> +</div> + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-race"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">race</span><span data-ice="signature">(tasks: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span>*</span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/race.js.html#lineNumber42">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import race from '<span><a href="file/lib/race.js.html#lineNumber42">async/lib/race.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Runs the <code>tasks</code> array of functions in parallel, without waiting until the +previous function has completed. Once any the <code>tasks</code> completed or pass an +error to its callback, the main <code>callback</code> is immediately called. It's +equivalent to <code>Promise.race()</code>.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">tasks</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>An array containing functions to run. Each function +is passed a <code>callback(err, result)</code> which it must call on completion with an +error <code>err</code> (which can be <code>null</code>) and an optional <code>result</code> value.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A callback to run once any of the functions have +completed. This function gets an error or result from the first function that +completed. Invoked with (err, result).</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span>*</span></td> + <td class="return-desc" data-ice="returnDescription"><p>undefined</p> +</td> + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +async.race([ + function(callback) { + setTimeout(function() { + callback(null, 'one'); + }, 200); + }, + function(callback) { + setTimeout(function() { + callback(null, 'two'); + }, 100); + } +], +// main callback +function(err, result) { + // the result will be equal to 'two' as it finishes earlier +});</code></pre> + </div> +</div> + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-reduce"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">reduce</span><span data-ice="signature">(coll: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>, memo: <span>*</span>, iteratee: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/reduce.js.html#lineNumber42">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import reduce from '<span><a href="file/lib/reduce.js.html#lineNumber42">async/lib/reduce.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Reduces <code>coll</code> into a single value using an async <code>iteratee</code> to return each +successive step. <code>memo</code> is the initial state of the reduction. This function +only operates in series.</p> +<p>For performance reasons, it may make sense to split a call to this function +into a parallel map, and then use the normal <code>Array.prototype.reduce</code> on the +results. This function is for situations where each step in the reduction +needs to be async; if you can get the data before reducing it, then it's +probably a good idea to do so.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">coll</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A collection to iterate over.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">memo</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>The initial state of the reduction.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">iteratee</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A function applied to each item in the +array to produce the next step in the reduction. The <code>iteratee</code> is passed a +<code>callback(err, reduction)</code> which accepts an optional error as its first +argument, and the state of the reduction as the second. If an error is +passed to the callback, the reduction is stopped and the main <code>callback</code> is +immediately called with the error. Invoked with (memo, item, callback).</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>A callback which is called after all the +<code>iteratee</code> functions have finished. Result is the reduced value. Invoked with +(err, result).</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +async.reduce([1,2,3], 0, function(memo, item, callback) { + // pointless async: + process.nextTick(function() { + callback(null, memo + item) + }); +}, function(err, result) { + // result is now equal to the last value of memo, which is 6 +});</code></pre> + </div> +</div> + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-reduceRight"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">reduceRight</span><span data-ice="signature">(coll: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>, memo: <span>*</span>, iteratee: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/reduceRight.js.html#lineNumber26">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import reduceRight from '<span><a href="file/lib/reduceRight.js.html#lineNumber26">async/lib/reduceRight.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Same as <code>reduce</code>, only operates on <code>coll</code> in reverse order.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">coll</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A collection to iterate over.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">memo</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>The initial state of the reduction.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">iteratee</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A function applied to each item in the +array to produce the next step in the reduction. The <code>iteratee</code> is passed a +<code>callback(err, reduction)</code> which accepts an optional error as its first +argument, and the state of the reduction as the second. If an error is +passed to the callback, the reduction is stopped and the main <code>callback</code> is +immediately called with the error. Invoked with (memo, item, callback).</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>A callback which is called after all the +<code>iteratee</code> functions have finished. Result is the reduced value. Invoked with +(err, result).</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + + + + + <div data-ice="see"><h4>See:</h4><ul><li><span><a href="async.reduce">async.reduce</a></span></li></ul></div> + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-reflect"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">reflect</span><span data-ice="signature">(fn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/reflect.js.html#lineNumber42">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import reflect from '<span><a href="file/lib/reflect.js.html#lineNumber42">async/lib/reflect.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Wraps the function in another function that always returns data even when it +errors.</p> +<p>The object returned has either the property <code>error</code> or <code>value</code>.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">fn</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>The function you want to wrap</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td class="return-desc" data-ice="returnDescription"><p>A function that always passes null to it's callback as +the error. The second argument to the callback will be an <code>object</code> with +either an <code>error</code> or a <code>value</code> property.</p> +</td> + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +async.parallel([ + async.reflect(function(callback) { + // do some stuff ... + callback(null, 'one'); + }), + async.reflect(function(callback) { + // do some more stuff but error ... + callback('bad stuff happened'); + }), + async.reflect(function(callback) { + // do some more stuff ... + callback(null, 'two'); + }) +], +// optional callback +function(err, results) { + // values + // results[0].value = 'one' + // results[1].error = 'bad stuff happened' + // results[2].value = 'two' +});</code></pre> + </div> +</div> + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-reflectAll"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">reflectAll</span><span data-ice="signature">(tasks: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/reflectAll.js.html#lineNumber42">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import reflectAll from '<span><a href="file/lib/reflectAll.js.html#lineNumber42">async/lib/reflectAll.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>A helper function that wraps an array of functions with reflect.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">tasks</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>The array of functions to wrap in <code>async.reflect</code>.</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span></td> + <td class="return-desc" data-ice="returnDescription"><p>Returns an array of functions, each function wrapped in +<code>async.reflect</code></p> +</td> + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +let tasks = [ + function(callback) { + setTimeout(function() { + callback(null, 'one'); + }, 200); + }, + function(callback) { + // do some more stuff but error ... + callback(new Error('bad stuff happened')); + }, + function(callback) { + setTimeout(function() { + callback(null, 'two'); + }, 100); + } +]; + +async.parallel(async.reflectAll(tasks), +// optional callback +function(err, results) { + // values + // results[0].value = 'one' + // results[1].error = Error('bad stuff happened') + // results[2].value = 'two' +});</code></pre> + </div> +</div> + + + + <div data-ice="see"><h4>See:</h4><ul><li><span><a href="async.reflect">async.reflect</a></span></li></ul></div> + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-reject"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">reject</span><span data-ice="signature">(eachfn: <span>*</span>, arr: <span>*</span>, iteratee: <span>*</span>, callback: <span>*</span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/internal/reject.js.html#lineNumber3">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import reject from '<span><a href="file/lib/internal/reject.js.html#lineNumber3">async/lib/internal/reject.js</a></span>'</code></pre></div> + + + + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">eachfn</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">arr</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">iteratee</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-retry"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">retry</span><span data-ice="signature">(opts: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, task: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/retry.js.html#lineNumber74">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import retry from '<span><a href="file/lib/retry.js.html#lineNumber74">async/lib/retry.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Attempts to get a successful response from <code>task</code> no more than <code>times</code> times +before returning an error. If the task is successful, the <code>callback</code> will be +passed the result of the successful task. If all attempts fail, the callback +will be passed the error and result (if any) of the final attempt.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">opts</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>= {times: 5, interval: 0}| 5] - Can be either an +object with <code>times</code> and <code>interval</code> or a number.</p> +<ul> +<li><code>times</code> - The number of attempts to make before giving up. The default +is <code>5</code>.</li> +<li><code>interval</code> - The time to wait between retries, in milliseconds. The +default is <code>0</code>. The interval may also be specified as a function of the +retry count (see example).</li> +<li>If <code>opts</code> is a number, the number specifies the number of times to retry, +with the default interval of <code>0</code>.</li> +</ul> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">task</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A function which receives two arguments: (1) a +<code>callback(err, result)</code> which must be called when finished, passing <code>err</code> +(which can be <code>null</code>) and the <code>result</code> of the function's execution, and (2) +a <code>results</code> object, containing the results of the previously executed +functions (if nested inside another control flow). Invoked with +(callback, results).</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>An optional callback which is called when the +task has succeeded, or after the final failed attempt. It receives the <code>err</code> +and <code>result</code> arguments of the last attempt at completing the <code>task</code>. Invoked +with (err, results).</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +// The `retry` function can be used as a stand-alone control flow by passing +// a callback, as shown below: + +// try calling apiMethod 3 times +async.retry(3, apiMethod, function(err, result) { + // do something with the result +}); + +// try calling apiMethod 3 times, waiting 200 ms between each retry +async.retry({times: 3, interval: 200}, apiMethod, function(err, result) { + // do something with the result +}); + +// try calling apiMethod 10 times with exponential backoff +// (i.e. intervals of 100, 200, 400, 800, 1600, ... milliseconds) +async.retry({ + times: 10, + interval: function(retryCount) { + return 50 * Math.pow(2, retryCount); + } +}, apiMethod, function(err, result) { + // do something with the result +}); + +// try calling apiMethod the default 5 times no delay between each retry +async.retry(apiMethod, function(err, result) { + // do something with the result +}); + +// It can also be embedded within other control flow functions to retry +// individual methods that are not as reliable, like this: +async.auto({ + users: api.getUsers.bind(api), + payments: async.retry(3, api.getPayments.bind(api)) +}, function(err, results) { + // do something with the results +});</code></pre> + </div> +</div> + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-retryable"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">retryable</span><span data-ice="signature">(opts: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, task: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span>Functions</span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/retryable.js.html#lineNumber27">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import retryable from '<span><a href="file/lib/retryable.js.html#lineNumber27">async/lib/retryable.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>A close relative of <code>retry</code>. This method wraps a task and makes it +retryable, rather than immediately calling it with retries.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">opts</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>= {times: 5, interval: 0}| 5] - optional +options, exactly the same as from <code>retry</code></p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">task</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>the asynchronous function to wrap</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span>Functions</span></td> + <td class="return-desc" data-ice="returnDescription"><p>The wrapped function, which when invoked, will retry on +an error, based on the parameters specified in <code>opts</code>.</p> +</td> + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +async.auto({ + dep1: async.retryable(3, getFromFlakyService), + process: ["dep1", async.retryable(3, function (results, cb) { + maybeProcessData(results.dep1, cb); + })] +}, callback);</code></pre> + </div> +</div> + + + + <div data-ice="see"><h4>See:</h4><ul><li><span><a href="async.retry">async.retry</a></span></li></ul></div> + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-series"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">series</span><span data-ice="signature">(tasks: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/series.js.html#lineNumber67">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import series from '<span><a href="file/lib/series.js.html#lineNumber67">async/lib/series.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Run the functions in the <code>tasks</code> collection in series, each one running once +the previous function has completed. If any functions in the series pass an +error to its callback, no more functions are run, and <code>callback</code> is +immediately called with the value of the error. Otherwise, <code>callback</code> +receives an array of results when <code>tasks</code> have completed.</p> +<p>It is also possible to use an object instead of an array. Each property will +be run as a function, and the results will be passed to the final <code>callback</code> +as an object instead of an array. This can be a more readable way of handling + results from <span>async.series</span>.</p> +<p><strong>Note</strong> that while many implementations preserve the order of object +properties, the <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-8.6">ECMAScript Language Specification</a> +explicitly states that</p> +<blockquote> +<p>The mechanics and order of enumerating the properties is not specified.</p> +</blockquote> +<p>So if you rely on the order in which your series of functions are executed, +and want this to work on all platforms, consider using an array.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">tasks</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A collection containing functions to run, each +function is passed a <code>callback(err, result)</code> it must call on completion with +an error <code>err</code> (which can be <code>null</code>) and an optional <code>result</code> value.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>An optional callback to run once all the +functions have completed. This function gets a results array (or object) +containing all the result arguments passed to the <code>task</code> callbacks. Invoked +with (err, result).</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode">async.series([ + function(callback) { + // do some stuff ... + callback(null, 'one'); + }, + function(callback) { + // do some more stuff ... + callback(null, 'two'); + } +], +// optional callback +function(err, results) { + // results is now equal to ['one', 'two'] +}); + +async.series({ + one: function(callback) { + setTimeout(function() { + callback(null, 1); + }, 200); + }, + two: function(callback){ + setTimeout(function() { + callback(null, 2); + }, 100); + } +}, function(err, results) { + // results is now equal to: {one: 1, two: 2} +});</code></pre> + </div> +</div> + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-sortBy"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">sortBy</span><span data-ice="signature">(coll: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>, iteratee: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/sortBy.js.html#lineNumber51">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import sortBy from '<span><a href="file/lib/sortBy.js.html#lineNumber51">async/lib/sortBy.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Sorts a list by the results of running each <code>coll</code> value through an async +<code>iteratee</code>.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">coll</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A collection to iterate over.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">iteratee</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A function to apply to each item in <code>coll</code>. +The iteratee is passed a <code>callback(err, sortValue)</code> which must be called once +it has completed with an error (which can be <code>null</code>) and a value to use as +the sort criteria. Invoked with (item, callback).</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>A callback which is called after all the +<code>iteratee</code> functions have finished, or an error occurs. Results is the items +from the original <code>coll</code> sorted by the values returned by the <code>iteratee</code> +calls. Invoked with (err, results).</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +async.sortBy(['file1','file2','file3'], function(file, callback) { + fs.stat(file, function(err, stats) { + callback(err, stats.mtime); + }); +}, function(err, results) { + // results is now the original array of files sorted by + // modified date +}); + +// 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 +}); + +// 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 +});</code></pre> + </div> +</div> + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-timeLimit"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">timeLimit</span><span data-ice="signature">(count: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, limit: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, iteratee: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/timesLimit.js.html#lineNumber19">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import timeLimit from '<span><a href="file/lib/timesLimit.js.html#lineNumber19">async/lib/timesLimit.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>The same as <span>times</span> but runs a maximum of <code>limit</code> async operations at a +time.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">count</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>The number of times to run the function.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">limit</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>The maximum number of async operations at a time.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">iteratee</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>The function to call <code>n</code> times. Invoked with the +iteration index and a callback (n, next).</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>see <span>async.map</span>.</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + + + + + <div data-ice="see"><h4>See:</h4><ul><li><span><a href="async.times">async.times</a></span></li></ul></div> + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-timeout"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">timeout</span><span data-ice="signature">(asyncFn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, milliseconds: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span>, info: <span>*</span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/timeout.js.html#lineNumber25">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import timeout from '<span><a href="file/lib/timeout.js.html#lineNumber25">async/lib/timeout.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Sets a time limit on an asynchronous function. If the function does not call +its callback within the specified milliseconds, it will be called with a +timeout error. The code property for the error object will be <code>'ETIMEDOUT'</code>.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">asyncFn</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>The asynchronous function you want to set the +time limit.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">milliseconds</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>The specified time limit.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">info</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>Any variable you want attached (<code>string</code>, <code>object</code>, etc) +to timeout Error for more information..</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td class="return-desc" data-ice="returnDescription"><p>Returns a wrapped function that can be used with any of +the control flow functions.</p> +</td> + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +async.timeout(function(callback) { + doAsyncTask(callback); +}, 1000);</code></pre> + </div> +</div> + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-transform"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">transform</span><span data-ice="signature">(coll: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span>, accumulator: <span>*</span>, iteratee: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/transform.js.html#lineNumber49">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import transform from '<span><a href="file/lib/transform.js.html#lineNumber49">async/lib/transform.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>A relative of <code>reduce</code>. Takes an Object or Array, and iterates over each +element in series, each step potentially mutating an <code>accumulator</code> value. +The type of the accumulator defaults to the type of collection passed in.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">coll</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span> | <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A collection to iterate over.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">accumulator</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>The initial state of the transform. If omitted, +it will default to an empty Object or Array, depending on the type of <code>coll</code></p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">iteratee</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A function applied to each item in the +collection that potentially modifies the accumulator. The <code>iteratee</code> is +passed a <code>callback(err)</code> which accepts an optional error as its first +argument. If an error is passed to the callback, the transform is stopped +and the main <code>callback</code> is immediately called with the error. +Invoked with (accumulator, item, key, callback).</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>A callback which is called after all the +<code>iteratee</code> functions have finished. Result is the transformed accumulator. +Invoked with (err, result).</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +async.transform([1,2,3], function(acc, item, index, callback) { + // pointless async: + process.nextTick(function() { + acc.push(item * 2) + callback(null) + }); +}, function(err, result) { + // result is now equal to [2, 4, 6] +});</code></pre> + </div> +<div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +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} +})</code></pre> + </div> +</div> + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-unmemoize"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">unmemoize</span><span data-ice="signature">(fn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/unmemoize.js.html#lineNumber13">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import unmemoize from '<span><a href="file/lib/unmemoize.js.html#lineNumber13">async/lib/unmemoize.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Undoes a <span>async.memoize</span>d function, reverting it to the original, +unmemoized form. Handy for testing.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">fn</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>the memoized function</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td class="return-desc" data-ice="returnDescription"><p>a function that calls the original unmemoized function</p> +</td> + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + + + + + <div data-ice="see"><h4>See:</h4><ul><li><span><a href="async.memoize">async.memoize</a></span></li></ul></div> + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-until"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">until</span><span data-ice="signature">(test: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, fn: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>)</span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/until.js.html#lineNumber25">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import until from '<span><a href="file/lib/until.js.html#lineNumber25">async/lib/until.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Repeatedly call <code>fn</code> until <code>test</code> returns <code>true</code>. Calls <code>callback</code> when +stopped, or an error occurs. <code>callback</code> will be passed an error and any +arguments passed to the final <code>fn</code>'s callback.</p> +<p>The inverse of <span>async.whilst</span>.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">test</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>synchronous truth test to perform before each +execution of <code>fn</code>. Invoked with ().</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">fn</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A function which is called each time <code>test</code> fails. +The function is passed a <code>callback(err)</code>, which must be called once it has +completed with an optional <code>err</code> argument. Invoked with (callback).</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>A callback which is called after the test +function has passed and repeated execution of <code>fn</code> has stopped. <code>callback</code> +will be passed an error and any arguments passed to the final <code>fn</code>'s +callback. Invoked with (err, [results]);</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + + + + + + + + + + + + + <div data-ice="see"><h4>See:</h4><ul><li><span><a href="async.whilst">async.whilst</a></span></li></ul></div> + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-waterfall"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">waterfall</span><span data-ice="signature">(tasks: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span>*</span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/waterfall.js.html#lineNumber64">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import waterfall from '<span><a href="file/lib/waterfall.js.html#lineNumber64">async/lib/waterfall.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Runs the <code>tasks</code> array of functions in series, each passing their results to +the next in the array. However, if any of the <code>tasks</code> pass an error to their +own callback, the next function is not executed, and the main <code>callback</code> is +immediately called with the error.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">tasks</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>An array of functions to run, each function is passed +a <code>callback(err, result1, result2, ...)</code> it must call on completion. The +first argument is an error (which can be <code>null</code>) and any further arguments +will be passed as arguments in order to the next task.</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>An optional callback to run once all the +functions have completed. This will be passed the results of the last task's +callback. Invoked with (err, [results]).</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span>*</span></td> + <td class="return-desc" data-ice="returnDescription"><p>undefined</p> +</td> + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +async.waterfall([ + function(callback) { + callback(null, 'one', 'two'); + }, + function(arg1, arg2, callback) { + // arg1 now equals 'one' and arg2 now equals 'two' + callback(null, 'three'); + }, + function(arg1, callback) { + // arg1 now equals 'three' + callback(null, 'done'); + } +], function (err, result) { + // result now equals 'done' +}); + +// Or, with named functions: +async.waterfall([ + myFirstFunction, + mySecondFunction, + myLastFunction, +], function (err, result) { + // result now equals 'done' +}); +function myFirstFunction(callback) { + callback(null, 'one', 'two'); +} +function mySecondFunction(arg1, arg2, callback) { + // arg1 now equals 'one' and arg2 now equals 'two' + callback(null, 'three'); +} +function myLastFunction(arg1, callback) { + // arg1 now equals 'three' + callback(null, 'done'); +}</code></pre> + </div> +</div> + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-whilst"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">whilst</span><span data-ice="signature">(test: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, iteratee: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>, callback: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span>): <span>*</span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/whilst.js.html#lineNumber38">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import whilst from '<span><a href="file/lib/whilst.js.html#lineNumber38">async/lib/whilst.js</a></span>'</code></pre></div> + + + <div data-ice="description"><p>Repeatedly call <code>fn</code>, while <code>test</code> returns <code>true</code>. Calls <code>callback</code> when +stopped, or an error occurs.</p> +</div> + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">test</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>synchronous truth test to perform before each +execution of <code>fn</code>. Invoked with ().</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">iteratee</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"></td> + <td data-ice="description"><p>A function which is called each time <code>test</code> passes. +The function is passed a <code>callback(err)</code>, which must be called once it has +completed with an optional <code>err</code> argument. Invoked with (callback).</p> +</td> + </tr> +<tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">callback</td> + <td data-ice="type"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a></span></td> + <td data-ice="appendix"><ul><li>optional</li></ul></td> + <td data-ice="description"><p>A callback which is called after the test +function has failed and repeated execution of <code>fn</code> has stopped. <code>callback</code> +will be passed an error and any arguments passed to the final <code>fn</code>'s +callback. Invoked with (err, [results]);</p> +</td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span>*</span></td> + <td class="return-desc" data-ice="returnDescription"><p>undefined</p> +</td> + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + <div data-ice="example"> + <h4>Example:</h4> + + <div class="example-doc" data-ice="exampleDoc"> + + <pre class="prettyprint source-code"><code data-ice="exampleCode"> +var count = 0; +async.whilst( + function() { return count < 5; }, + function(callback) { + count++; + setTimeout(function() { + callback(null, count); + }, 1000); + }, + function (err, n) { + // 5 seconds have passed, n = 5 + } +);</code></pre> + </div> +</div> + + + + + +</div> +<div class="detail" data-ice="detail"> + <h3 data-ice="anchor" id="static-function-wrap"> + <span class="access" data-ice="access">public</span> + + + + + <span data-ice="name">wrap</span><span data-ice="signature">(defer: <span>*</span>): <span>*</span></span> + <span class="right-info"> + + + <span data-ice="source"><span><a href="file/lib/internal/setImmediate.js.html#lineNumber12">source</a></span></span> + </span> + </h3> + + <div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import {wrap} from '<span><a href="file/lib/internal/setImmediate.js.html#lineNumber12">async/lib/internal/setImmediate.js</a></span>'</code></pre></div> + + + + + + + <div data-ice="properties"><div data-ice="properties"> + <h4 data-ice="title">Params:</h4> + <table class="params"> + <thead> + <tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr> + </thead> + <tbody> + + <tr data-ice="property" data-depth="0"> + <td data-ice="name" data-depth="0">defer</td> + <td data-ice="type"><span>*</span></td> + <td data-ice="appendix"></td> + <td data-ice="description"></td> + </tr> +</tbody> + </table> +</div> +</div> + + <div class="return-params" data-ice="returnParams"> + <h4>Return:</h4> + <table> + <tr> + <td class="return-type" data-ice="returnType"><span>*</span></td> + + </tr> + </table> + <div data-ice="returnProperties"> +</div> + </div> + + + + + + + + + + + + + +</div> +</div> +</div> + +<footer class="footer"> + Generated by <a href="https://esdoc.org">ESDoc<span data-ice="esdocVersion">(0.4.7)</span></a> +</footer> + +<script src="script/search_index.js"></script> +<script src="script/search.js"></script> +<script src="script/pretty-print.js"></script> +<script src="script/inherited-summary.js"></script> +<script src="script/test-summary.js"></script> +<script src="script/inner-link.js"></script> +<script src="script/patch-for-local.js"></script> +</body> +</html> |