zhouxianguang 4ff8c8d55d submit code 6 anos atrás
..
dist 4ff8c8d55d submit code 6 anos atrás
internal 4ff8c8d55d submit code 6 anos atrás
CHANGELOG.md 4ff8c8d55d submit code 6 anos atrás
LICENSE 4ff8c8d55d submit code 6 anos atrás
README.md 4ff8c8d55d submit code 6 anos atrás
all.js 4ff8c8d55d submit code 6 anos atrás
allLimit.js 4ff8c8d55d submit code 6 anos atrás
allSeries.js 4ff8c8d55d submit code 6 anos atrás
any.js 4ff8c8d55d submit code 6 anos atrás
anyLimit.js 4ff8c8d55d submit code 6 anos atrás
anySeries.js 4ff8c8d55d submit code 6 anos atrás
apply.js 4ff8c8d55d submit code 6 anos atrás
applyEach.js 4ff8c8d55d submit code 6 anos atrás
applyEachSeries.js 4ff8c8d55d submit code 6 anos atrás
asyncify.js 4ff8c8d55d submit code 6 anos atrás
auto.js 4ff8c8d55d submit code 6 anos atrás
autoInject.js 4ff8c8d55d submit code 6 anos atrás
bower.json 4ff8c8d55d submit code 6 anos atrás
cargo.js 4ff8c8d55d submit code 6 anos atrás
compose.js 4ff8c8d55d submit code 6 anos atrás
concat.js 4ff8c8d55d submit code 6 anos atrás
concatLimit.js 4ff8c8d55d submit code 6 anos atrás
concatSeries.js 4ff8c8d55d submit code 6 anos atrás
constant.js 4ff8c8d55d submit code 6 anos atrás
detect.js 4ff8c8d55d submit code 6 anos atrás
detectLimit.js 4ff8c8d55d submit code 6 anos atrás
detectSeries.js 4ff8c8d55d submit code 6 anos atrás
dir.js 4ff8c8d55d submit code 6 anos atrás
doDuring.js 4ff8c8d55d submit code 6 anos atrás
doUntil.js 4ff8c8d55d submit code 6 anos atrás
doWhilst.js 4ff8c8d55d submit code 6 anos atrás
during.js 4ff8c8d55d submit code 6 anos atrás
each.js 4ff8c8d55d submit code 6 anos atrás
eachLimit.js 4ff8c8d55d submit code 6 anos atrás
eachOf.js 4ff8c8d55d submit code 6 anos atrás
eachOfLimit.js 4ff8c8d55d submit code 6 anos atrás
eachOfSeries.js 4ff8c8d55d submit code 6 anos atrás
eachSeries.js 4ff8c8d55d submit code 6 anos atrás
ensureAsync.js 4ff8c8d55d submit code 6 anos atrás
every.js 4ff8c8d55d submit code 6 anos atrás
everyLimit.js 4ff8c8d55d submit code 6 anos atrás
everySeries.js 4ff8c8d55d submit code 6 anos atrás
filter.js 4ff8c8d55d submit code 6 anos atrás
filterLimit.js 4ff8c8d55d submit code 6 anos atrás
filterSeries.js 4ff8c8d55d submit code 6 anos atrás
find.js 4ff8c8d55d submit code 6 anos atrás
findLimit.js 4ff8c8d55d submit code 6 anos atrás
findSeries.js 4ff8c8d55d submit code 6 anos atrás
foldl.js 4ff8c8d55d submit code 6 anos atrás
foldr.js 4ff8c8d55d submit code 6 anos atrás
forEach.js 4ff8c8d55d submit code 6 anos atrás
forEachLimit.js 4ff8c8d55d submit code 6 anos atrás
forEachOf.js 4ff8c8d55d submit code 6 anos atrás
forEachOfLimit.js 4ff8c8d55d submit code 6 anos atrás
forEachOfSeries.js 4ff8c8d55d submit code 6 anos atrás
forEachSeries.js 4ff8c8d55d submit code 6 anos atrás
forever.js 4ff8c8d55d submit code 6 anos atrás
groupBy.js 4ff8c8d55d submit code 6 anos atrás
groupByLimit.js 4ff8c8d55d submit code 6 anos atrás
groupBySeries.js 4ff8c8d55d submit code 6 anos atrás
index.js 4ff8c8d55d submit code 6 anos atrás
inject.js 4ff8c8d55d submit code 6 anos atrás
log.js 4ff8c8d55d submit code 6 anos atrás
map.js 4ff8c8d55d submit code 6 anos atrás
mapLimit.js 4ff8c8d55d submit code 6 anos atrás
mapSeries.js 4ff8c8d55d submit code 6 anos atrás
mapValues.js 4ff8c8d55d submit code 6 anos atrás
mapValuesLimit.js 4ff8c8d55d submit code 6 anos atrás
mapValuesSeries.js 4ff8c8d55d submit code 6 anos atrás
memoize.js 4ff8c8d55d submit code 6 anos atrás
nextTick.js 4ff8c8d55d submit code 6 anos atrás
package.json 4ff8c8d55d submit code 6 anos atrás
parallel.js 4ff8c8d55d submit code 6 anos atrás
parallelLimit.js 4ff8c8d55d submit code 6 anos atrás
priorityQueue.js 4ff8c8d55d submit code 6 anos atrás
queue.js 4ff8c8d55d submit code 6 anos atrás
race.js 4ff8c8d55d submit code 6 anos atrás
reduce.js 4ff8c8d55d submit code 6 anos atrás
reduceRight.js 4ff8c8d55d submit code 6 anos atrás
reflect.js 4ff8c8d55d submit code 6 anos atrás
reflectAll.js 4ff8c8d55d submit code 6 anos atrás
reject.js 4ff8c8d55d submit code 6 anos atrás
rejectLimit.js 4ff8c8d55d submit code 6 anos atrás
rejectSeries.js 4ff8c8d55d submit code 6 anos atrás
retry.js 4ff8c8d55d submit code 6 anos atrás
retryable.js 4ff8c8d55d submit code 6 anos atrás
select.js 4ff8c8d55d submit code 6 anos atrás
selectLimit.js 4ff8c8d55d submit code 6 anos atrás
selectSeries.js 4ff8c8d55d submit code 6 anos atrás
seq.js 4ff8c8d55d submit code 6 anos atrás
series.js 4ff8c8d55d submit code 6 anos atrás
setImmediate.js 4ff8c8d55d submit code 6 anos atrás
some.js 4ff8c8d55d submit code 6 anos atrás
someLimit.js 4ff8c8d55d submit code 6 anos atrás
someSeries.js 4ff8c8d55d submit code 6 anos atrás
sortBy.js 4ff8c8d55d submit code 6 anos atrás
timeout.js 4ff8c8d55d submit code 6 anos atrás
times.js 4ff8c8d55d submit code 6 anos atrás
timesLimit.js 4ff8c8d55d submit code 6 anos atrás
timesSeries.js 4ff8c8d55d submit code 6 anos atrás
transform.js 4ff8c8d55d submit code 6 anos atrás
tryEach.js 4ff8c8d55d submit code 6 anos atrás
unmemoize.js 4ff8c8d55d submit code 6 anos atrás
until.js 4ff8c8d55d submit code 6 anos atrás
waterfall.js 4ff8c8d55d submit code 6 anos atrás
whilst.js 4ff8c8d55d submit code 6 anos atrás
wrapSync.js 4ff8c8d55d submit code 6 anos atrás

README.md

Async Logo

Build Status via Travis CI NPM version Coverage Status libhive - Open source examples jsDelivr Hits

Async is a utility module which provides straight-forward, powerful functions for working with asynchronous JavaScript. Although originally designed for use with Node.js and installable via npm install --save async, it can also be used directly in the browser.

This version of the package is optimized for the Node.js environment. If you use Async with webpack, install async-es instead.

For Documentation, visit https://caolan.github.io/async/

For Async v1.5.x documentation, go HERE

// for use with Node-style callbacks...
var async = require("async");

var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"};
var configs = {};

async.forEachOf(obj, (value, key, callback) => {
    fs.readFile(__dirname + value, "utf8", (err, data) => {
        if (err) return callback(err);
        try {
            configs[key] = JSON.parse(data);
        } catch (e) {
            return callback(e);
        }
        callback();
    });
}, err => {
    if (err) console.error(err.message);
    // configs is now a map of JSON data
    doSomethingWith(configs);
});
var async = require("async");

// ...or ES2017 async functions
async.mapLimit(urls, 5, async function(url) {
    const response = await fetch(url)
    return response.body
}, (err, results) => {
    if (err) throw err
    // results is now an array of the response bodies
    console.log(results)
})