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