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

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