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