UNPKG

@lodestar/beacon-node

Version:

A Typescript implementation of the beacon chain

17 lines 546 B
/** * Group an array of items by ForkName according to the slot associted to each item */ export function groupByFork(config, items, getSlot) { const itemsByFork = new Map(); for (const item of items) { const forkName = config.getForkName(getSlot(item)); let itemsInFork = itemsByFork.get(forkName); if (!itemsInFork) { itemsInFork = []; itemsByFork.set(forkName, itemsInFork); } itemsInFork.push(item); } return itemsByFork; } //# sourceMappingURL=forkName.js.map