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

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