Skip to content

Commit

Permalink
release 2.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
lzear committed Nov 4, 2022
1 parent 04ba095 commit c837a78
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 25 deletions.
5 changes: 0 additions & 5 deletions .changeset/lazy-pumas-trade.md

This file was deleted.

7 changes: 7 additions & 0 deletions demo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# demo

## 0.0.3

### Patch Changes

- Updated dependencies [04ba095]
- [email protected]

## 0.0.2

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions demo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "demo",
"version": "0.0.2",
"version": "0.0.3",
"private": true,
"scripts": {
"dev": "yarn workspace votes preconstruct dev && next dev",
Expand Down Expand Up @@ -50,7 +50,7 @@
"react-spring": "^9.5.5",
"react-with-gesture": "^4.0.8",
"typescript": "4.8.4",
"votes": "2.0.4",
"votes": "2.0.5",
"zustand": "^4.1.4"
},
"devDependencies": {
Expand Down
40 changes: 23 additions & 17 deletions votes/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# votes

## 2.0.5

### Patch Changes

- 04ba095: Remove `array.at` from the codebase

## 2.0.4

### Patch Changes
Expand Down Expand Up @@ -27,38 +33,38 @@
**Old:**

```typescript
import { utils as voteUtils, VotingSystem } from "votes";
import { utils as voteUtils, VotingSystem } from 'votes'

const scores = scoresFromBallots(
[
{ ranking: [["Lion"], ["Bear"], ["Sheep"]], weight: 4 },
{ ranking: [["Sheep"], ["Bear"], ["Lion"]], weight: 3 },
{ ranking: [["Bear", "Sheep"], ["Lion"]], weight: 2 }
{ ranking: [['Lion'], ['Bear'], ['Sheep']], weight: 4 },
{ ranking: [['Sheep'], ['Bear'], ['Lion']], weight: 3 },
{ ranking: [['Bear', 'Sheep'], ['Lion']], weight: 2 },
],
["Lion", "Bear", "Sheep"],
VotingSystem.Schulze
);
['Lion', 'Bear', 'Sheep'],
VotingSystem.Schulze,
)
// -> { Lion: 0, Bear: 2, Sheep: 1 }
const ranking = scoresToRanking({ Bear: 2, Lion: 0, Sheep: 1 });
const ranking = scoresToRanking({ Bear: 2, Lion: 0, Sheep: 1 })
// -> [ [ 'Bear' ], [ 'Sheep' ], [ 'Lion' ] ]
```

**New:**

```typescript
import { Borda } from "votes";
import { Borda } from 'votes'

const borda = new Borda({
candidates: ["Lion", "Bear", "Sheep"],
candidates: ['Lion', 'Bear', 'Sheep'],
ballots: [
{ ranking: [["Lion"], ["Bear"], ["Sheep"]], weight: 4 },
{ ranking: [["Sheep"], ["Bear"], ["Lion"]], weight: 3 },
{ ranking: [["Bear", "Sheep"], ["Lion"]], weight: 2 }
]
});
const scores = borda.scores();
{ ranking: [['Lion'], ['Bear'], ['Sheep']], weight: 4 },
{ ranking: [['Sheep'], ['Bear'], ['Lion']], weight: 3 },
{ ranking: [['Bear', 'Sheep'], ['Lion']], weight: 2 },
],
})
const scores = borda.scores()
// -> { Bear: 10, Lion: 8, Sheep: 9}
const ranking = borda.ranking();
const ranking = borda.ranking()
// -> [ [ 'Bear' ], [ 'Sheep' ], [ 'Lion' ] ]
```

Expand Down
2 changes: 1 addition & 1 deletion votes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "votes",
"main": "dist/votes.cjs.js",
"module": "dist/votes.esm.js",
"version": "2.0.4",
"version": "2.0.5",
"description": "Implementation of some [electoral systems](https://en.wikipedia.org/wiki/Electoral_system)",
"keywords": [
"votes",
Expand Down

1 comment on commit c837a78

@vercel
Copy link

@vercel vercel bot commented on c837a78 Nov 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

votes – ./

rank-votes.vercel.app
votes-git-master-lzear.vercel.app
votes-lzear.vercel.app

Please sign in to comment.