
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
Calculates the Gallagher index for an election result.
The Gallagher index measures an electoral system’s relative disproportionality between votes received and seats allotted in a legislature. As such, it measures the difference between the percentage of votes each party gets, and the percentage of seats each party gets in the resulting legislature -- and it measures this dis-proportionality from all parties collectively in one given election. This collective dis-proportionality from this one election is given a precise score, which can then be used in comparing various levels of proportionality among various elections from various electoral systems.
var gallagher = require('gallagher');
var parties = [
{ name: 'Party A', votes: 1058636, seats: 59 },
{ name: 'Party B', votes: 614937, seats: 34 },
{ name: 'Party C', votes: 247372, seats: 14 },
{ name: 'Party D', votes: 147544, seats: 8 },
{ name: 'Party E', votes: 59237, seats: 0 },
{ name: 'Party F', votes: 31982, seats: 3 },
{ name: 'Party G', votes: 24168, seats: 1 },
{ name: 'Party H', votes: 23889, seats: 1 },
{ name: 'Party I', votes: 13443, seats: 1 },
{ name: 'Party J', votes: 11738, seats: 0 },
{ name: 'Party K', votes: 1714, seats: 0 },
{ name: 'Party L', votes: 1595, seats: 0 },
{ name: 'Party M', votes: 1209, seats: 0 }
];
var result = gallagher(parties); // 2.377974544114885
FAQs
Calculates the Gallagher Index for an election result.
The npm package gallagher receives a total of 1 weekly downloads. As such, gallagher popularity was classified as not popular.
We found that gallagher demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rust’s crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.