An implementation of the Go's WaitGroup for Node.js.
npm install --save wait-group-promise
const WaitGroup = require('wait-group-promise');
const wg = new WaitGroup();
wg.add(2);
const p = wg.wait();
setTimeout(() => {
wg.done();
}, 5000);
setTimeout(() => {
wg.done();
}, 3000);
await p;