Basic Batch
The most basic of batches
It's Brittney Batch
Install
npm install --save basic-batch
Example
const BasicBatch = require('basic-batch');
const batch = new BasicBatch(5);
batch.on('processReady', ({ items, done }) => { // wait for your queue to fill up
setTimeout(() => {
console.log(items); // get your items from the queue
done(); // call this to let BasicBatch know you're done with this batch
}, Math.random(1, 5) * 1000);
});
for(let i=0; i<100; i++) {
batch.push(i); // filling our queue with some numbers to test
}
It's that basic