meek-stv

0.1.0 • Public • Published

meek-stv

a lightweight meek stv javascript library

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);

Readme

Keywords

none

Package Sidebar

Install

npm i meek-stv

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

58.6 kB

Total Files

48

Last publish

Collaborators

  • taytems