You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
QMZ d3d1f40723
2 weeks ago
..
dist 2 weeks ago
internal 2 weeks ago
CHANGELOG.md 2 weeks ago
LICENSE 2 weeks ago
README.md 2 weeks ago
all.js 2 weeks ago
allLimit.js 2 weeks ago
allSeries.js 2 weeks ago
any.js 2 weeks ago
anyLimit.js 2 weeks ago
anySeries.js 2 weeks ago
apply.js 2 weeks ago
applyEach.js 2 weeks ago
applyEachSeries.js 2 weeks ago
asyncify.js 2 weeks ago
auto.js 2 weeks ago
autoInject.js 2 weeks ago
bower.json 2 weeks ago
cargo.js 2 weeks ago
compose.js 2 weeks ago
concat.js 2 weeks ago
concatLimit.js 2 weeks ago
concatSeries.js 2 weeks ago
constant.js 2 weeks ago
detect.js 2 weeks ago
detectLimit.js 2 weeks ago
detectSeries.js 2 weeks ago
dir.js 2 weeks ago
doDuring.js 2 weeks ago
doUntil.js 2 weeks ago
doWhilst.js 2 weeks ago
during.js 2 weeks ago
each.js 2 weeks ago
eachLimit.js 2 weeks ago
eachOf.js 2 weeks ago
eachOfLimit.js 2 weeks ago
eachOfSeries.js 2 weeks ago
eachSeries.js 2 weeks ago
ensureAsync.js 2 weeks ago
every.js 2 weeks ago
everyLimit.js 2 weeks ago
everySeries.js 2 weeks ago
filter.js 2 weeks ago
filterLimit.js 2 weeks ago
filterSeries.js 2 weeks ago
find.js 2 weeks ago
findLimit.js 2 weeks ago
findSeries.js 2 weeks ago
foldl.js 2 weeks ago
foldr.js 2 weeks ago
forEach.js 2 weeks ago
forEachLimit.js 2 weeks ago
forEachOf.js 2 weeks ago
forEachOfLimit.js 2 weeks ago
forEachOfSeries.js 2 weeks ago
forEachSeries.js 2 weeks ago
forever.js 2 weeks ago
groupBy.js 2 weeks ago
groupByLimit.js 2 weeks ago
groupBySeries.js 2 weeks ago
index.js 2 weeks ago
inject.js 2 weeks ago
log.js 2 weeks ago
map.js 2 weeks ago
mapLimit.js 2 weeks ago
mapSeries.js 2 weeks ago
mapValues.js 2 weeks ago
mapValuesLimit.js 2 weeks ago
mapValuesSeries.js 2 weeks ago
memoize.js 2 weeks ago
nextTick.js 2 weeks ago
package.json 2 weeks ago
parallel.js 2 weeks ago
parallelLimit.js 2 weeks ago
priorityQueue.js 2 weeks ago
queue.js 2 weeks ago
race.js 2 weeks ago
reduce.js 2 weeks ago
reduceRight.js 2 weeks ago
reflect.js 2 weeks ago
reflectAll.js 2 weeks ago
reject.js 2 weeks ago
rejectLimit.js 2 weeks ago
rejectSeries.js 2 weeks ago
retry.js 2 weeks ago
retryable.js 2 weeks ago
select.js 2 weeks ago
selectLimit.js 2 weeks ago
selectSeries.js 2 weeks ago
seq.js 2 weeks ago
series.js 2 weeks ago
setImmediate.js 2 weeks ago
some.js 2 weeks ago
someLimit.js 2 weeks ago
someSeries.js 2 weeks ago
sortBy.js 2 weeks ago
timeout.js 2 weeks ago
times.js 2 weeks ago
timesLimit.js 2 weeks ago
timesSeries.js 2 weeks ago
transform.js 2 weeks ago
tryEach.js 2 weeks ago
unmemoize.js 2 weeks ago
until.js 2 weeks ago
waterfall.js 2 weeks ago
whilst.js 2 weeks ago
wrapSync.js 2 weeks ago

README.md

Async Logo

Build Status via Travis CI NPM version Coverage Status Join the chat at https://gitter.im/caolan/async 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)
})