This small script takes a json file of ballots and determines the winner using the Borda method.
npx borda-vote-counter /path/to/votes.json
The JSON file should be an array of ballot arrays. The first item in each ballot is the preferred option, the last is the least preferred option.
[
[ "OB", "SL" ],
[ "SL", "CL", "OB", "SB" ],
[ "OB", "SL", "SB", "CL", "TR" ],
[ "SL", "SB", "TR", "CL", "OB" ],
[ "OB" ],
[ "OB", "SB", "SL" ],
[ "TR", "CL", "SL", "OB" ],
[ "SB", "CL", "OB" ]
]
The above json file will result in the following output:
WINNER { option: 'OB', value: 21 }