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

README.md

Async Logo

Github Actions CI status NPM version Coverage Status 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 i async, it can also be used directly in the browser. An ESM/MJS version is included in the main async package that should automatically be used with compatible bundlers such as Webpack and Rollup.

A pure ESM version of Async is available as async-es.

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