mirror of
https://github.com/gchq/CyberChef.git
synced 2025-06-16 11:15:00 -04:00
Add Base45 operations
Closes #1219 Co-developed-by: Cyril Delétré <cyril.deletre@gmail.com>
This commit is contained in:
parent
ae1b12c120
commit
6017578964
6 changed files with 280 additions and 0 deletions
|
@ -1206,6 +1206,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue