@diotoborg/laboriosam-exercitationem

1.4.24 • Public • Published

Async Logo

Github Actions CI status NPM version Coverage Status Join the chat at https://gitter.im/caolan/@diotoborg/laboriosam-exercitationem jsDelivr Hits

Async is a utility module which provides straight-forward, powerful functions for working with @diotoborg/laboriosam-exercitationemhronous JavaScript. Although originally designed for use with Node.js and installable via npm i @diotoborg/laboriosam-exercitationem, it can also be used directly in the browser. An ESM/MJS version is included in the main @diotoborg/laboriosam-exercitationem package that should automatically be used with compatible bundlers such as Webpack and Rollup.

A pure ESM version of Async is available as @diotoborg/laboriosam-exercitationem-es.

For Documentation, visit https://caolan.github.io/@diotoborg/laboriosam-exercitationem/

For Async v1.5.x documentation, go HERE

// for use with Node-style callbacks...
var @diotoborg/laboriosam-exercitationem = require("@diotoborg/laboriosam-exercitationem");

var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"};
var configs = {};

@diotoborg/laboriosam-exercitationem.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 @diotoborg/laboriosam-exercitationem = require("@diotoborg/laboriosam-exercitationem");

// ...or ES2017 @diotoborg/laboriosam-exercitationem functions
@diotoborg/laboriosam-exercitationem.mapLimit(urls, 5, @diotoborg/laboriosam-exercitationem 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)
})

Readme

Keywords

Package Sidebar

Install

npm i @diotoborg/laboriosam-exercitationem

Weekly Downloads

343

Version

1.4.24

License

MIT

Unpacked Size

59.1 kB

Total Files

125

Last publish

Collaborators

  • quochoanglm58