in-parallel
A node module for running async tasks on an array and finishing together to run a final function.
Installation
npm install in-parallel --save
Usage
Initialize inParallel like so:
//the proceedAfterParallelAction() method is provided var inParallel = ;
A Simple Example
var collection = 123; inParallel;
A Less Simple Example With MongoDB Queries
Imagine you have a bunch of users and each user has a bunch of photos all stored in a mongodb. If you have to get each user's photo and do something with them, it'd probably be best to run such tasks in parallel:
//a less simple use case with a MongoDB query var users = user1user2user3; inParallel;
Config
Debug Messages
Debug messages are printed to the console by default but you can choose not have that like so:
inParallel;
Tests
npm test
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.
Release History
- 0.1.0 Initial release
Credits
I used this article to learn how to publish npm articles: https://quickleft.com/blog/creating-and-publishing-a-node-js-module/