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) • 488 B
TypeScript
import { Divisor } from './divisors/divisor';
import { Candidate } from './models/candidate';
import { CandidateResult } from './models/candidate_result';
import './extensions/array_extensions';
export declare class HighestAverage {
private readonly divisor;
private readonly candidates;
private seat;
constructor(divisor: Divisor);
withSeat(seat: number): HighestAverage;
withCandidates(candidates: Candidate[]): HighestAverage;
apply(): CandidateResult[];
}