dis-dat
Version:
Run commands in parallel (dad / dis-and-dat) or sequentially (dtd / dis-then-dat)
14 lines (13 loc) • 485 B
JavaScript
import worker from './worker.js';
export * from './types.js';
export default function disDat(commands, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options = options || {};
if (typeof callback === 'function') return worker(commands, options, callback);
return new Promise((resolve, reject)=>worker(commands, options, (err, results)=>{
err ? reject(err) : resolve(results);
}));
}