UNPKG

hard-source-webpack-plugin-fixed-hashbug

Version:

Hard cache the source of modules in webpack. Patched version fixing the hash bug

30 lines (27 loc) 695 B
// Perform a set of tasks in array quickly. Sometimes testing much better for // large sets of work instead of individual promises. const bulkFsTask = (array, each) => new Promise((resolve, reject) => { let ops = 0; const out = []; array.forEach((item, i) => { out[i] = each(item, (back, callback) => { ops++; return (err, value) => { try { out[i] = back(err, value, out[i]); } catch (e) { return reject(e); } ops--; if (ops === 0) { resolve(out); } }; }); }); if (ops === 0) { resolve(out); } }); module.exports = bulkFsTask;