UNPKG

highest-averages

Version:

Zero-dependency and extensible set of highest averages methods for allocating seats in a parliament. ### Install ```shell npm i highest-averages ``` ### Pure Example - Define the candidates with their vote ```typescript const a = new Candidate('A', 200) c

12 lines (11 loc) 299 B
import './map_extensions'; export {}; declare global { export interface Array<T> { groupBy<A>(selector: (item: T) => A): Map<A, T[]>; sum(this: number[]): number; sumOf(selector: (item: T) => number): number; flatten(this: T[]): T; clear(): void; } }