Merge branch 'base45' of https://github.com/t-8ch/CyberChef into t-8ch-base45

This commit is contained in:
n1474335 2022-03-28 16:04:34 +01:00
commit 709b8696fc
7 changed files with 313 additions and 0 deletions

View file

@ -1207,6 +1207,30 @@ class Utils {
}[token];
}
/**
* Iterate object in chunks of given size.
*
* @param {Iterable} iterable
* @param {number} chunksize
*/
static* chunked(iterable, chunksize) {
const iterator = iterable[Symbol.iterator]();
while (true) {
const res = [];
for (let i = 0; i < chunksize; i++) {
const next = iterator.next();
if (next.done) {
break;
}
res.push(next.value);
}
if (res.length) {
yield res;
} else {
return;
}
}
}
}
/**