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

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