Skip to content

TateB/meek-stv

Repository files navigation

meek-stv

a lightweight meek stv javascript library

based on caritat

Usage

import Election and Ballot from the package

import { Election, Ballot } from "meek-stv";

create a new election with the available options and your candidates

const candidates = ["Epic", "Cool", "Nice", "Great"];

const election = new Election({ candidates });

add the ballots to the election

election.addBallot(new Ballot(["Cool", "Epic", "Great", "Nice"], 29));

election.addBallot(new Ballot(["Epic", "Cool", "Great", "Nice"], 13));

election.addBallot(new Ballot(["Great", "Epic", "Cool", "Nice"], 38));

election.addBallot(new Ballot(["Nice", "Epic", "Cool", "Great"], 15));

run the election with the amount of seats you want elected and get the results

const results = election.run(1);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published