UNPKG

ecclesia

Version:

Framework for political and electoral simulations

17 lines (16 loc) 456 B
// src/election/attribution/metrics.ts function defaultMetric({ votes, seats }) { const allVotes = votes.total; const allSeats = seats.total; let suum = 0; for (const party of seats.keys()) { const partyVotes = votes.get(party); const partySeats = seats.get(party); suum += Math.abs(allSeats * partyVotes / allVotes - partySeats); } return suum / seats.size; } export { defaultMetric }; //# sourceMappingURL=chunk-UWP5NKUP.js.map