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

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