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

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