@xpressit/winning-poker-hand-rank

Determine winning poker hand rank


Keywords
card, playing cards, casino, library, poker, poker hand rank, hand evaluator, rank hands, node, typescript
License
MIT
Install
npm install @xpressit/winning-poker-hand-rank@0.2.1

Documentation

Winning Poker Hand Rank

Winning Poker Hand Rank is a library for evaluating poker hand ranks written in Typescript. This is a rewrite from https://github.com/cardrank/cardrank and supports the following game types:

  • Texas Holdem
  • Omaha
  • Ace to Six (Shortdeck)

Installation

npm install winning-poker-hand-rank

Usage

const gameType = 'texas';
const board = ['5D', '8D', 'TD', 'AS', 'QS'];
const player1Cards = ['TC', 'TS'];
const player2Cards = ['2D', '3D'];

const result = rankHands(gameType, board, [player1Cards, player2Cards]);

Output:

[
    {
        rank: 1875,
        combination: 'ThreeOfAKind',
        madeHand: ['TC', 'TS', 'TD', 'AS', 'QS'],
        unused: ['5D', '8D']
    },
    {
        rank: 1531,
        combination: 'Flush',
        madeHand: ['2D', '3D', '5D', '8D', 'TD'],
        unused: ['AS', 'QS']
    }
]