Caelus3,462 checksGitHubv0.26.0MIT
API Reference / stratifiedSelect · function

Function: stratifiedSelect()

function stratifiedSelect<T>(entries, budget): T[];

Deterministic bucket-preserving compaction selector (EXP-002 / EXP-007).

Partitions entries by stratum, ranks each bucket by descending score (or recency when score is absent; ties broken by lexicographical String(id) then original index), orders strata by descending peak score (ties broken by lexicographical stratum key), and sweeps round-robin across distinct strata up to budget.

Type Parameters

Type Parameter
T extends StratifiedEntry

Parameters

ParameterType
entriesreadonly T[]
budgetnumber

Returns

T[]

Start building

Quickstart →