Skip to main content

formatPotOdds

Human-readable "x:1" string.

formatPotOdds(potBeforeCall: number, toCall: number, decimals?: number): string

Import

const poker = require('poker-calculations');

ESM (Node):

import { createRequire } from 'module';
const require = createRequire(import.meta.url);
const poker = require('poker-calculations');

When to use

Render pot odds in the UI without hand-formatting floats. Optional decimals controls rounding of the leading number in the x:1 display.

How to use

console.log(poker.formatPotOdds(175, 50)); // "3.5:1"
console.log(poker.formatPotOdds(175, 50, 0)); // "4:1" with 0 decimals
console.log(poker.formatPotOddsReducedFraction(100, 50)); // "2:1" integer form

See also

potOddsRatioDisplay · formatPotOddsReducedFraction