# hand-ranker

> a poker hand ranking module

Latest version **0.2.0** (published 2017-07-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install hand-ranker
pnpm add hand-ranker
yarn add hand-ranker
bun add hand-ranker
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2017-07-17 |
| First published | 2015-08-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | @kaftz |
| Maintainers | kaftz |
| Keywords | poker, holdem, hand, ranking |

## Links

- npm: https://www.npmjs.com/package/hand-ranker
- Repository: https://github.com/kaftz/hand-ranker
- Homepage: https://github.com/kaftz/hand-ranker#readme
- Issues: https://github.com/kaftz/hand-ranker/issues
- npm.io page: https://npm.io/package/hand-ranker

## Recent versions

- 0.2.0 (latest) — 2017-07-17
- 0.1.4 — 2017-05-03
- 0.1.3 — 2015-08-19
- 0.1.2 — 2015-08-15
- 0.1.1 — 2015-08-15
- 0.1.0 — 2015-08-15

## README

## hand-ranker

Returns the best possible 5-card poker hand from an array of N >= 5 cards.

## installation

```
npm install hand-ranker
```

## usage

A card is represented by an object with properties 's' and 'v', where 's' describes the suit (s = spade, h = heart, c = club, d = diamond) and 'v' describes the value (1 = ace, 13 = king).

`bestHand(cards)` - returns a results object with the best 5-card hand (sorted), a string describing the hand, an integer hand value (0 = high card, 8 = straight flush)

```javascript
var ranker = require('hand-ranker');

var cards = [
  { s: 's', v: 10 },
  { s: 'c', v: 1 },
  { s: 's', v: 13 },
  { s: 's', v: 1 },
  { s: 'd', v: 1 },
  { s: 's', v: 12 },
  { s: 's', v: 11 }
];

var result = ranker.bestHand(cards);

/*
result:
{
  hand: [
    { s: 's', v: 10 },
    { s: 's', v: 11 },
    { s: 's', v: 12 },
    { s: 's', v: 13 },
    { s: 's', v: 1 }
  ],
  type: 'straight flush',
  val: 8
}
*/
```

## license

MIT

---
_Source: https://npm.io/package/hand-ranker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
