You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			|  | 6 months ago | |
|---|---|---|
| .. | ||
| dist | 6 months ago | |
| internal | 6 months ago | |
| CHANGELOG.md | 6 months ago | |
| LICENSE | 6 months ago | |
| README.md | 6 months ago | |
| apply.js | 6 months ago | |
| autoInject.js | 6 months ago | |
| cargo.js | 6 months ago | |
| detectLimit.js | 6 months ago | |
| during.js | 6 months ago | |
| eachSeries.js | 6 months ago | |
| everySeries.js | 6 months ago | |
| filterLimit.js | 6 months ago | |
| flatMapLimit.js | 6 months ago | |
| foldl.js | 6 months ago | |
| forever.js | 6 months ago | |
| groupByLimit.js | 6 months ago | |
| groupBySeries.js | 6 months ago | |
| index.js | 6 months ago | |
| log.js | 6 months ago | |
| mapValuesSeries.js | 6 months ago | |
| memoize.js | 6 months ago | |
| parallel.js | 6 months ago | |
| queue.js | 6 months ago | |
| reduceRight.js | 6 months ago | |
| reflectAll.js | 6 months ago | |
| rejectLimit.js | 6 months ago | |
| retryable.js | 6 months ago | |
| sortBy.js | 6 months ago | |
		
			
				
				README.md
			
		
		
	
	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 i async, it can also be used directly in the browser.  A ESM/MJS version is included in the main async package that should automatically be used with compatible bundlers such as Webpack and Rollup.
A pure ESM version of Async is available as async-es.
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)
})
