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