https://github.com/hdoc1509/poker-hand-verifier
Verifier of poker hand
https://github.com/hdoc1509/poker-hand-verifier
evaluator poker poker-cards poker-evaluator poker-hands verifier
Last synced: 4 months ago
JSON representation
Verifier of poker hand
- Host: GitHub
- URL: https://github.com/hdoc1509/poker-hand-verifier
- Owner: Hdoc1509
- License: mit
- Created: 2022-06-27T23:09:11.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-03-29T21:56:30.000Z (about 2 years ago)
- Last Synced: 2025-02-16T04:02:44.207Z (4 months ago)
- Topics: evaluator, poker, poker-cards, poker-evaluator, poker-hands, verifier
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/poker-hand-verifier
- Size: 291 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[](https://github.com/Hdoc1509/poker-hand-verifier/actions/workflows/ci.yml)
# Poker Hand Verifier
Provides a verifier for a poker hand of 5 cards.
It works on browser and server side.
## Installation
Using npm with Node.js >= 12:
```sh
npm install poker-hand-verifier
```Using unpkg CDN:
```html
```
## How to use
You can use CommonJS or ESM syntax.
```js
import { verificateHand } from 'poker-hand-verifier';const myCards = [
{ number: '4', suit: 'S' },
{ number: '5', suit: 'H' },
{ number: '8', suit: 'D' },
{ number: '7', suit: 'S' },
{ number: '6', suit: 'C' },
];console.log(verificateHand(myCards));
// {
// cards: ['4S', '5H', '8D', '7S', '6C'],
// description: 'Straight: 4 - 8',
// type: 'straight'
// }
```Using with CDN, verificateHand() will be available as a method of a global variable called 'pokerHandVerifier'.
```html
const myCards = [
{ number: '10', suit: 'S' },
{ number: 'K', suit: 'S' },
{ number: 'J', suit: 'S' },
{ number: 'Q', suit: 'S' },
{ number: 'A', suit: 'S' },
];console.log(pokerHandVerifier.verificateHand(myCards));
// {
// cards: ['10S', 'KH', 'JD', 'QS', 'AC'],
// description: 'Royal Flush (S)',
// type: 'royal-flush'
// }```