Quick start
const poker = require('poker-calculations');
const hand = poker.evaluateBestHand(['Ah', 'Ac', 'Kd', 'Ks', 'Qh']);
console.log(hand.rank);
const equity = poker.simulateHandOutcome(
['Ah', 'Kh'],
['Qh', 'Jh', 'Th'],
2000,
42,
1,
);
console.log('Equity:', equity);
console.log('SPR:', poker.spr(90, 270));
For long Monte Carlo runs without blocking the event loop, use simulateHandOutcomeAsync. Pass optional AsyncOptions to cancel via AbortSignal—the Promise rejects with AbortError:
const ac = new AbortController();
const pending = poker.simulateHandOutcomeAsync(
['Ah', 'Kh'],
['Qh', 'Jh', 'Th'],
100_000,
42,
1,
{ signal: ac.signal },
);
// ac.abort(); // rejects with AbortError
Cards use strings like "Ah", "Td" (ten may be "10h"). Most card-list APIs also accept packed Uint8Array deck ids — see Card notation.
Explore the API
Browse the full API reference—every export documents Import, When to use, and How to use.