locutus
Version:
Locutus other languages' standard libraries to JavaScript for fun and educational purposes
13 lines (12 loc) • 527 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.batched = batched;
const _itertools_ts_1 = require("../_helpers/_itertools.js");
function batched(iterable, n) {
// discuss at: https://locutus.io/python/itertools/batched/
// parity verified: Python 3.12
// original by: Kevin van Zonneveld (https://kvz.io)
// example 1: batched([1, 2, 3, 4, 5], 2)
// returns 1: [[1, 2], [3, 4], [5]]
return (0, _itertools_ts_1.itertoolsBatched)(iterable, n);
}