UNPKG

ecclesia

Version:

Framework for political and electoral simulations

24 lines (23 loc) 954 B
import { type Simple } from "../tally"; import { type Attribution, type HasNSeats } from "../attribution"; /** * Creates an attribution method in which * the party with the most votes wins all the seats. * * Will throw an AttributionFailure error if no party wins any vote. */ export declare function plurality<Party>({ nSeats }: { nSeats: number; }): Attribution<Party, Simple<Party>> & HasNSeats; /** * Creates an attribution method in which a candidate needs to reach * a certain percentage of the votes in order to win all the seats. * * If not party reaches the threshold, the contingency attribution method is called, * or if no contingency is provided, an AttributionFailure error is thrown. */ export declare function superMajority<Party>({ nSeats, threshold, contingency }: { nSeats: number; threshold: number; contingency?: Attribution<Party, Simple<Party>> | null; }): Attribution<Party, Simple<Party>> & HasNSeats;