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

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