npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

poker-calc

v0.1.9

Published

Fastest way to calcaulate poker hand types, best hand, Texas Hold'em winner. More comming soon.

Downloads

31

Readme

poker-calc

npm version Downloads License: MIT Build Status

NPM NPM

Fastest way to calculate poker hand types, best hand, Texas Hold'em winner, Omaha winner, get type of five cards hand. More coming soon.

Installation

npm install poker-calc --save

Testing (after installing)

npm test

Usage

var pokerCalc = require('poker-calc');

var params = {
    "boardCards": [
        { "type": "heart", "rank": 1 },
        { "type": "heart", "rank": 2 },
        { "type": "heart", "rank": 11 },
        { "type": "heart", "rank": 10 },
        { "type": "heart", "rank": 13 }
    ],
    "playerCards": [{ "playerId": "1", "cards": [{ "type": "spade", "rank": 11 }, { "type": "club", "rank": 3 }] },
        { "playerId": "2", "cards": [{ "type": "heart", "rank": 6 }, { "type": "club", "rank": 5 }] }
    ]
}

var params2 = {
    "boardCards": [                 // ["14H", "2H", "JH", "10H", "KH"]
        "AH", "2H", "JH", "10H", "KH"
    ],
    "playerCards": [{ "playerId": "1", "cards": ["JS", "3C"] },
        { "playerId": "2", "cards": ["6H", "5C"] }
    ]
}

var winner = pokerCalc.getHoldemWinner(params,{ compactCards: false});   //winner is an array which contains the winners
//output
[
  {
    "playerId": "2",
    "hand": {
      "handInfo": {
        "type": "Flush",
        "strength": 6
      },
      "cards": [
        {
          "type": "Heart",
          "rank": 1,
          "name": "A",
          "priority": 14
        },
        {
          "type": "Heart",
          "rank": 13,
          "name": "K",
          "priority": 13
        },
        {
          "type": "Heart",
          "rank": 11,
          "name": "J",
          "priority": 11
        },
        {
          "type": "Heart",
          "rank": 10,
          "name": "10",
          "priority": 10
        },
        {
          "type": "Heart",
          "rank": 6,
          "name": "6",
          "priority": 6
        }
      ]
    }
  }
]



var winner = pokerCalc.getHoldemWinner(params2,{ compactCards: true});  //winner is an array which contains the winners
//output
[
  {
    "playerId": "2",
    "hand": {
      "handInfo": {
        "type": "Flush",
        "strength": 6
      },
      "cards": [
        "AH",
        "KH",
        "JH",
        "10H",
        "6H"
      ]
    }
  }
]

//for omaha winners
var winners = pokerCalc.getOmahaWinner(params)  //here the playerCards for each player should be four

//to get type of five cards hand
var typeObject =  pokerCalc.getType(cards)          //array of five cards
//output  { type:"flush", strength:6 }

Notes

  • compactCards flag can be used in both card formats.
  • Cards in compact format as in params2 is not supported in pokerCalc.getOmahaWinner.
  • Cards in any format as illustrated above are supported for pokerCalc.getType
  • Ranks of different cards are as below
  • Card - Rank
    • A - 1
    • 2 - 2
    • 3 - 3
    • 4 - 4
    • 5 - 5
    • 6 - 6
    • 7 - 7
    • 8 - 8
    • 9 - 9
    • 10 - 10
    • J - 11
    • Q - 12
    • k - 13