@reuters-graphics/electoral-college-permutations
v0.0.2
Published
[![npm version](https://badge.fury.io/js/%40reuters-graphics%2Felectoral-college-permutations.svg)](https://badge.fury.io/js/%40reuters-graphics%2Felectoral-college-permutations) [![Reuters open source software](https://badgen.net/badge/Reuters/open%20sou
Downloads
1
Keywords
Readme
@reuters-graphics/electoral-college-permutations
Quickstart
$ yarn add @reuters-graphics/electoral-college-permutations
import Election2020Scenarios from '@reuters-graphics/electoral-college-permutations';
const outstandingStates = {
WI: 10,
MI: 16,
GA: 16,
PA: 20,
NC: 15,
AZ: 11,
NV: 6,
AK: 3,
};
const candidateElectoralVotes = {
R: 213,
D: 227,
};
const election2020Scenarios = new Election2020Scenarios(candidateElectoralVotes, outstandingStates);
const scenarios = election2020Scenarios.call('MI', 'D');
// {
// states: ['WI', 'MI', ...],
// scenariosByWinner: {
// R: [
// {
// scenario: ['R', 'D', ...],
// result: { R: 220, D: 230 },
// },
// ...
// ],
// D: [ {}, ...],
// Tie: [{}, ...],
// }
// }
Testing
$ yarn test