"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.partitionBy = void 0;
function partitionBy(items, keyFn) {
    const partitions = [];
    let lastPartition = null;
    let lastKey = null;
    for (const item of items) {
        const key = keyFn(item);
        if (lastPartition && lastKey === key) {
            lastPartition.push(item);
        }
        else {
            lastPartition = [item];
            lastKey = key;
            partitions.push(lastPartition);
        }
    }
    return partitions;
}
exports.partitionBy = partitionBy;
//# sourceMappingURL=list.js.map