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

node-texas-evaluator

v0.1.1

Published

Texas Hold'em hand evaluator for node.js.

Downloads

1

Readme

texas

Texas is a library to provide 5 to 7 card hands evaluation for Texas Hold'em on node.js. It uses the look-up table method created by users of the Two Plus Two forum.

Installing

npm install node-texas-evaluator

Using

Evaluator

The following example generates a random hand and evaluates it:

var _ = require('underscore');
var texas = require('node-texas-evaluator');

var hand = _.first(texas.deck(), 7);
console.log(_.map(hand, texas.abbr));
console.log(texas.evaluate(hand));

Which will output something like:

[ '5h', '3s', '4d', '7s', '5d', 'Jd', '6d' ]
{ name: 'Straight', value: 20483 }

Odds

The following example calculates the odds of a 2-player game after the flop:

var texas = require('node-texas-evaluator');

var odds = texas.odds([['As', 'Ac'], ['Ks', 'Qc']], ['3d', 'Qc', 'Kd']);
console.log(odds);

Which will output something like:

[ { win: 0.2608695652173913, split: 0 },
  { win: 0.7391304347826086, split: 0 } ]

Formats

Extended

> texas.extended(3)
'Two of Hearts'

Abbreviated

> texas.abbr(15)
'5h'

Unicode

> texas.unicode(42)
'Q♦'

Benchmark

A benchmark function is included in the library. It evaluates every possible 7 card hands.

> texas.benchmark()
Invalid: 0
High Card: 23294460
One Pair: 58627800
Two Pairs: 31433400
Three of a Kind: 6461620
Straight: 6180020
Flush: 4047644
Full House: 3473184
Four of a Kind: 224848
Straight Flush: 41584
Total: 133784560
891ms // On a Mid 2011 13" MacBook Air