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

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