Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/maxgfr/condorcet-winner

A simple condorcet vote algorithm implementation in typescript
https://github.com/maxgfr/condorcet-winner

condorcet condorcet-vote condorcet-voting condorcet-voting-algorithms condorcet-winner node typescript vote

Last synced: 7 days ago
JSON representation

A simple condorcet vote algorithm implementation in typescript

Awesome Lists containing this project

README

        

# condorcet-winner

This library is a TypeScript implementation of the [Condorcet method](https://en.wikipedia.org/wiki/Condorcet_method) for determining the winner of a [Condorcet paradox](https://en.wikipedia.org/wiki/Condorcet_paradox) election.

## Installation

```bash
yarn add condorcet-winner
```

## Usage

```typescript
import { condorcetWinner } from 'condorcet-winner';

const winner = condorcetWinner(
['A', 'B', 'C'],
[
['A', 'B', 'C'],
['B', 'A', 'C'],
['C', 'A', 'B'],
],
);

console.log(winner); // 'A'
```