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

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