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

14 lines (13 loc) 402 B
import { Pair } from '../utilities/pair'; export {}; declare global { export interface Map<K, V> { getOrElse(key: K, item: V): V; mappableKeys(): K[]; mappableValues(): V[]; mappableEntries(): Array<Pair<K, V>>; mapKeys<R>(f: (key: K) => R): R[]; mapValues<R>(f: (value: V) => R): R[]; mapEntries<R>(f: (pair: Pair<K, V>) => R): R[]; } }