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 🙏

© 2026 – Pkg Stats / Ryan Hefner

poker-wasm

v2.3.0

Published

WASM range vs range equity for NLHE

Readme

power-range-rs

Hold'em range vs range equity calculation in 11 µs or less

^Omaha in ~390 µs for 2000 vs 2000 random hands. Supports PLO5 and PLO6

Usage

npm install poker-wasm
# optionally https://github.com/conradbkay/poker-utils
npm install poker-utils

NLHE Equity Calculation

Calculate equity for a Hold'em range vs another range:

import { EquityCalculator, HoldemRange } from "poker-wasm"

const calculator = new EquityCalculator()

const heroRange = new HoldemRange()
const vsRange = new HoldemRange()

// Add hands to ranges (cards are 0-51, As=51)
heroRange.setHand(new Uint8Array([51, 50]), 1.0) // AA with 100% weight
heroRange.setHand(new Uint8Array([47, 46]), 1.0) // KK with 100% weight

vsRange.setHand(new Uint8Array([43, 42]), 1.0) // QQ
vsRange.setHand(new Uint8Array([39, 38]), 1.0) // JJ

// Set ranges once (avoids repeated memory transfers)
calculator.setHeroRange(heroRange)
calculator.setVsRange(vsRange)

// Calculate equity on a flop
const board = new Uint8Array([0, 12, 28])
const results = calculator.equityVsRange(board)

// Results contain equity for each hand in hero's range
results.forEach(({ combo, equity }) => {
  console.log(
    `[${combo}] 
    win=${equity.win.toFixed(3)}
    tie=${equity.tie.toFixed(3)}
    lose=${equity.lose.toFixed(3)}`
  )
})

// Per-runout NLHE equity for one hero hand vs the cached villain range.
// Flattened as [win, tie, lose, win, tie, lose, ...].
const heroHand = new Uint8Array([51, 50])
const turn = new Uint8Array([0, 12, 28, 10])
const runoutWeights = calculator.runoutEquities(heroHand, turn)

// Flop boards can also be sampled with a deterministic seed.
const sampledRunoutWeights = calculator.runoutEquities(
  heroHand,
  board,
  1000,
  1234
)

Omaha (PLO) Aggregate Range Equity

Calculate PLO equity for a hero range vs a villain range. The board may be 3, 4, or 5 cards; incomplete boards are enumerated. On a flop, passing maxRunouts samples that many turn/river runouts (Monte Carlo) instead of enumerating all of them. Works for PLO4, PLO5, and PLO6 (the range's hand size sets the variant).

import { EquityCalculator, OmahaRange } from "poker-wasm"

const calculator = new EquityCalculator()

// Hero and villain ranges (4-card hands here). Set once to avoid repeat transfers.
const heroRange = new OmahaRange(4)
heroRange.addHand(new Uint8Array([35, 34, 31, 30]), 1.0) // TT99

const vsRange = new OmahaRange(4)
vsRange.addHand(new Uint8Array([51, 50, 47, 46]), 1.0) // AAKK double suited
vsRange.addHand(new Uint8Array([43, 42, 39, 38]), 1.0) // QQJJ

calculator.setOmahaHeroRange(heroRange)
calculator.setOmahaVsRange(vsRange)

const flop = new Uint8Array([0, 1, 2]) // 2s 2h 2d

// Equity for every hero hand vs the villain range, aggregated over runouts.
// Pass 1000 to Monte Carlo sample the turn/river instead of full enumeration.
const results = calculator.omahaEquityVsRange(flop, 1000)
// ^ same format/type as results from NLHE example

Per-Runout Equity

For NLHE, use runoutEquities(heroHand, board, maxRunouts?, seed?). For Omaha, use omahaRunoutEquities(heroHand, board, maxRunouts?, seed?). Both return flat [win, tie, lose, ...] weights, one triple per complete runout.

const heroHand = new Uint8Array([35, 34, 31, 30])
const turn = new Uint8Array([0, 1, 2, 10])

calculator.setOmahaVsRange(vsRange)

// Full results with board + win/tie/lose weights per river.
const runouts = calculator.omahaRunoutEquityVsRange(heroHand, turn)

// Faster weight-only form, flattened as [win, tie, lose, ...].
const eqs = calculator.omahaRunoutEquities(heroHand, turn)

// Seeded flop sampling for reproducible tests.
const sampled = calculator.omahaRunoutEquities(heroHand, flop, 1000, 1234)