{"id":18488183,"url":"https://github.com/lzear/votes","last_synced_at":"2025-04-23T17:45:58.351Z","repository":{"id":35094133,"uuid":"205804192","full_name":"lzear/votes","owner":"lzear","description":"JS library for ranked voting systems","archived":false,"fork":false,"pushed_at":"2024-02-27T20:04:48.000Z","size":2088,"stargazers_count":24,"open_issues_count":6,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T03:38:53.953Z","etag":null,"topics":["borda","condorcet","election","kemeny","poll","ranked-voting","schulze","vote","voting-methods"],"latest_commit_sha":null,"homepage":"https://rank-votes.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lzear.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-02T07:49:39.000Z","updated_at":"2025-02-05T17:40:22.000Z","dependencies_parsed_at":"2024-02-27T10:58:56.805Z","dependency_job_id":"5da766db-c303-420f-8e9c-b8472570162f","html_url":"https://github.com/lzear/votes","commit_stats":{"total_commits":117,"total_committers":4,"mean_commits":29.25,"dds":0.1282051282051282,"last_synced_commit":"56efd2dc993da0e451fc97d09de6d7684aae8c05"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lzear%2Fvotes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lzear%2Fvotes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lzear%2Fvotes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lzear%2Fvotes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lzear","download_url":"https://codeload.github.com/lzear/votes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250484524,"owners_count":21438251,"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":["borda","condorcet","election","kemeny","poll","ranked-voting","schulze","vote","voting-methods"],"created_at":"2024-11-06T12:51:22.811Z","updated_at":"2025-04-23T17:45:58.333Z","avatar_url":"https://github.com/lzear.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# votes\n\n![version](https://img.shields.io/npm/v/votes)\n![npm bundle size](https://img.shields.io/bundlephobia/minzip/votes)\n![language](https://img.shields.io/github/languages/top/lzear/votes)\n![downloads](https://img.shields.io/npm/dm/votes)\n![last commit](https://img.shields.io/github/last-commit/lzear/votes)\n[![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/npm/votes)](https://libraries.io/npm/votes)\n[![license](https://img.shields.io/github/license/lzear/votes)](https://github.com/lzear/votes/blob/master/LICENSE)\n[![Build Status](https://travis-ci.com/lzear/votes.svg?branch=master)](https://travis-ci.com/lzear/votes)\n[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/d2378c63d95f41efb79072176f015976)](https://www.codacy.com/gh/lzear/votes/dashboard?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=lzear/votes\u0026utm_campaign=Badge_Coverage)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/08af655918d741d1bffca7ec12ba72be)](https://app.codacy.com/gh/lzear/votes?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=lzear/votes\u0026utm_campaign=Badge_Grade_Settings)\n[![CodeClimate Coverage](https://api.codeclimate.com/v1/badges/0a98aa30f16e04bc3eac/test_coverage)](https://codeclimate.com/github/lzear/votes/test_coverage)\n[![CodeClimate Maintainability](https://api.codeclimate.com/v1/badges/0a98aa30f16e04bc3eac/maintainability)](https://codeclimate.com/github/lzear/votes/maintainability)\n![Code Climate technical debt](https://img.shields.io/codeclimate/tech-debt/lzear/votes)\n[![CodeFactor](https://www.codefactor.io/repository/github/lzear/votes/badge)](https://www.codefactor.io/repository/github/lzear/votes)\n![codecov](https://codecov.io/gh/lzear/votes/branch/master/graph/badge.svg?token=Fd9Jk4FeBY)\n![npms.io (final)](https://img.shields.io/npms-io/maintenance-score/votes)\n![npms.io (final)](https://img.shields.io/npms-io/quality-score/votes)\n[![Website](https://img.shields.io/website?url=https%3A%2F%2Frank-votes.vercel.app%2F)](https://rank-votes.vercel.app/)\n\n## 🧑‍💻 Install\n\n```sh\nyarn add votes\n```\n\n## 🗳️ Use\n\n```typescript\nimport { Borda } from 'votes'\n\nconst borda = new Borda({\n  candidates: ['Lion', 'Bear', 'Sheep'],\n  ballots: [\n    { ranking: [['Lion'], ['Bear'], ['Sheep']], weight: 4 },\n    { ranking: [['Sheep'], ['Bear'], ['Lion']], weight: 3 },\n    { ranking: [['Bear', 'Sheep'], ['Lion']], weight: 2 },\n  ],\n})\n\nconst scores = borda.scores()\n// -\u003e { Bear: 10, Lion: 8, Sheep: 9}\n\nconst ranking = borda.ranking()\n// -\u003e [ [ 'Bear' ], [ 'Sheep' ], [ 'Lion' ] ]\n```\n\n## 📚 Documentation\n\n- 🧪 Demo/Playground: [rank-votes.vercel.app](https://rank-votes.vercel.app/)\n  _(work in progress!)_\n\n- 🧑‍🏫 Blog post on my website:\n  [🗳 Ranked voting systems](https://www.elzear.de/posts/2021-01-10-polls)\n\n- 💩 Library documentation:\n  [lzear.github.io/votes](https://lzear.github.io/votes/)\n\n- 🤓 Good Wikipedia article:\n  [Comparison of electoral systems](https://en.wikipedia.org/wiki/Comparison_of_electoral_systems)\n\n## 📊 Voting systems\n\n**Absolute majority**: Checks if a candidate is ranked first by more than 50% of\nvoters.\n\n**Approval voting**: Each voter can select (“approve”) any number of candidates.\nThe winner is the most-approved candidate.\n\n**Baldwin method**: Iterative Borda count in which, each round, candidates\nscoring the lowest score are eliminated.\n\n**Borda count**: For each voter, every candidate is given a number of points\nwhich equals the number of candidates ranked lower in the voter's preference.\n\n**Bottom-two-runoff**: take the two options with the fewest first preference\nvotes. The pairwise loser out of those two options is eliminated. Repeat.\n\n**Contingent vote** (immediate Two-round system): If no candidate receives 50%\nof the votes in the first round, then a second round of voting is held with only\nthe top two candidates.\n\n**Coombs' method**: Each round, the candidate with the most last rank is\neliminated. The election repeats until there is a winner.\n\n**Copeland's method**: Rank candidates by number of duels won against other\ncandidates.\n\n**Instant-runoff**: Considering only the top choice of each voter, the candidate\nwith the fewest votes is eliminated. The election repeats until there is a\nwinner. This voting system is very similar to single transferable vote method.\n\n**Kemeny–Young method**: A relatively complex computation generating a\npreference order aiming to minimize dissatisfaction of the voters. Also known as\nKemeny rule, VoteFair popularity ranking, the maximum likelihood method, and the\nmedian relation.\n\n**Maximal lotteries \u0026 Randomized Condorcet**: Returns probabilities for each\ncandidate that should be used for a lottery between the Candidates. If a\ncandidate is the Condorcet winner, its probability will be 1. Despite being\nnon-deterministic, those methods are the fairest. Currently, these methods give\nincorrect results in many cases because of mistakes in the codes!\n\n**Majority Judgement**: (**⚠️ cardinal voting system**). Voters can rank\ncandidates in an array corresponding to 6 categories (\"Excellent\", \"Very good\",\n\"Good\", \"Passable\", \"Mediocre\" and \"Bad\"). Candidates with the best median are\nranked first.\n\n**Minimax Condorcet method**: Ranking the candidates by smallest pairwise\ndefeat.\n\n**Minimax-TD**: Compute the [Smith set](https://en.wikipedia.org/wiki/Smith_set)\n. Then compute the Minimax ranking on that set. TD stands for\nTideman-Darlington.\n\n**Nanson method**: Iterative Borda count in which, each round, candidates\nscoring the average score or less are eliminated.\n\n**Plurality**: Simple voting method where only the preferred candidate of each\nvoter gets 1 point. AKA first-past-the-post.\n\n**Random candidate**: Selects a random ranking, regardless of ballots.\n\n**Random dictator**: Selects a random ballot that decides the ranking.\n\n**Ranked pairs**: Using the duel results as edges, build an acyclic graph\nstarting by the strongest score differences. The roots of the graph are the\nwinners.\n\n**Schulze method**: From the votes, compute the results of all possible duels.\nThen remove the most indecisive (closest to 50/50) duels until there is an\nundefeated candidate, the winner. This popular voting system is used by several\norganizations (Ubuntu, Debian, Wikimedia...).\n\n**Smith's method**: All members of the top cycle (a.k.a. Smith set): _\"the\nsmallest non-empty set of candidates in a particular election such that each\nmember defeats every candidate outside the set in a pairwise election\"_\n\n## 🤝 Contributing\n\nContributions, issues and feature requests are welcome!\u003cbr /\u003e Feel free to check\n[issues page](https://github.com/lzear/votes/issues).\n\nThe repository is split in 2 projects:\n\n- **/votes** contains the source of the NPM package\n  [votes](https://www.npmjs.com/package/votes)\n\n- **/demo** contains the source of the demo website\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flzear%2Fvotes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flzear%2Fvotes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flzear%2Fvotes/lists"}