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