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

README.md

Async Logo

Build Status via Travis CI Build Status via Azure Pipelines NPM version Coverage Status Join the chat at https://gitter.im/caolan/async 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 async, it can also be used directly in the browser. A ESM version is included in the main async package that should automatically be used with compatible bundlers such as Webpack and Rollup.

A pure ESM version of Async is available as async-es.

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)
})