@reuters-graphics/electoral-college-permutations

0.0.2 • Public • Published

@reuters-graphics/electoral-college-permutations

npm version Reuters open source software

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

Readme

Keywords

none

Package Sidebar

Install

npm i @reuters-graphics/electoral-college-permutations

Weekly Downloads

2

Version

0.0.2

License

MIT

Unpacked Size

91.3 kB

Total Files

7

Last publish

Collaborators

  • pkd2512
  • swhart22
  • mf475
  • allyjlevine
  • hobbes7878