{"id":17370179,"url":"https://github.com/juliuste/sainte-lague","last_synced_at":"2025-04-08T03:34:50.261Z","repository":{"id":13114600,"uuid":"73638804","full_name":"juliuste/sainte-lague","owner":"juliuste","description":"Sainte-Laguë method for seat distribution used in multiple parliamentary elections all over the world.","archived":false,"fork":false,"pushed_at":"2022-05-26T16:14:56.000Z","size":35,"stargazers_count":11,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-23T04:41:13.736Z","etag":null,"topics":["election","library"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juliuste.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-13T19:47:41.000Z","updated_at":"2024-05-14T18:30:57.000Z","dependencies_parsed_at":"2022-09-11T22:11:54.512Z","dependency_job_id":null,"html_url":"https://github.com/juliuste/sainte-lague","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Fsainte-lague","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Fsainte-lague/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Fsainte-lague/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Fsainte-lague/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juliuste","download_url":"https://codeload.github.com/juliuste/sainte-lague/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247772938,"owners_count":20993627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["election","library"],"created_at":"2024-10-16T00:35:47.348Z","updated_at":"2025-04-08T03:34:49.974Z","avatar_url":"https://github.com/juliuste.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sainte-lague\n\nAn implementation of the **[Sainte-Laguë](https://en.wikipedia.org/wiki/Webster/Sainte-Lagu%C3%AB_method)** (also known as **Webster** or **Schepers**) method. Parliament seat allocation algorithm used in multiple countries such as Germany, Latvia, New Zealand etc…\n\n*Attention: Since some countries (like Latvia or Norway) use a modification of the algorithm instead of this vanilla version, you should check your country's electoral legislature. Furthermore, I don't take any responsibility for the accuracy of the calculated numbers, even though I'm pretty confident with my implementation.*\n\n[![npm version](https://img.shields.io/npm/v/sainte-lague.svg)](https://www.npmjs.com/package/sainte-lague)\n[![License](https://img.shields.io/github/license/juliuste/sainte-lague.svg?style=flat)](license)\n[![Contact me](https://img.shields.io/badge/contact-email-turquoise)](mailto:mail@juliustens.eu)\n\n## Installation\n\n```shell\nnpm install sainte-lague\n```\n\n## Usage\n\n**This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).**\n\n```js\nimport sainteLague from 'sainte-lague'\n\nconst electionResults = { // number of votes per party\n\tsocialists: 130755,\n\tconservatives: 102068,\n\tliberals: 34012,\n\tgreens: 31090,\n\tcrazypeople: 11111\n}\nconst seats = 420 // number of seats to be distributed\nconst opt = { // options, can be null\n\tdraw: false // if a draw would be necessary to determine the seat count (e.g. 11 seats and two parties with 100 votes each), the library will throw an error, unless you set draw: true, in which case it will assert the ambiguous seat(s) randomly\n}\n\nconst parliament = sainteLague(electionResults, seats, opt)\n```\n\nThe `parliament` variable will look like this:\n\n```json\n{\n\t\"socialists\": 178,\n\t\"conservatives\": 139,\n\t\"liberals\": 46,\n\t\"greens\": 42,\n\t\"crazypeople\": 15\n}\n```\n\n## Similar Projects\n\n- [hare-niemeyer](https://github.com/juliuste/hare-niemeyer) - Hare-Niemeyer / Hamilton / largest remainder method\n- [DHondt](https://github.com/economia/DHondt) – D'Hondt method\n\n## Contributing\n\nIf you found a bug or want to propose a feature, feel free to visit [the issues page](https://github.com/juliuste/sainte-lague/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliuste%2Fsainte-lague","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliuste%2Fsainte-lague","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliuste%2Fsainte-lague/lists"}