|
@@ -5,7 +5,7 @@ const crypto = require("crypto");
|
|
const chainPromises = (lazyPromises, reducer = (lp1, lp2) => (p) => lp1(p).then(lp2), initialValue) => lazyPromises.reduce(reducer, p => Promise.resolve(p))(initialValue);
|
|
const chainPromises = (lazyPromises, reducer = (lp1, lp2) => (p) => lp1(p).then(lp2), initialValue) => lazyPromises.reduce(reducer, p => Promise.resolve(p))(initialValue);
|
|
exports.chainPromises = chainPromises;
|
|
exports.chainPromises = chainPromises;
|
|
const shuffleArray = (arr) => {
|
|
const shuffleArray = (arr) => {
|
|
- const res = arr.slice(0);
|
|
|
|
|
|
+ const res = arr.filter(e => e);
|
|
for (let i = res.length - 1; i > 0; i--) {
|
|
for (let i = res.length - 1; i > 0; i--) {
|
|
const j = crypto.randomInt(0, i + 1);
|
|
const j = crypto.randomInt(0, i + 1);
|
|
[res[i], res[j]] = [res[j], res[i]];
|
|
[res[i], res[j]] = [res[j], res[i]];
|