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