JSPM

odds-converter

1.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 633
  • Score
    100M100P100Q98552F
  • License ISC

convert odds between american, decimal, and fractional formats

Package Exports

  • odds-converter

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (odds-converter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Odds Converter

npm install odds-converter

var odds = require('odds-converter')

Decimal to American

Example:

odds.decimal.toAmerican(2.25); // 125.00

odds.decimal.toAmerican(1.90); // -111.11

Decimal to Fraction

odds.decimal.toFractional(1.75).simplify(); // (3/4)

odds.decimal.toFractional(3.5).simplify(); // (5/2)

Fraction to American

odds.fraction.toAmerican(7,4); // 175

odds.fraction.toAmerican(5,6); // -120

Fraction to Decimal

odds.fraction.toDecimal(3,2); // 3.2

odds.fraction.toDecimal(1,5); // 1.2

American to Decimal

odds.american.toDecimal(225); // 3.25

odds.american.toDecimal(-110); // 1.91

American to Fraction

odds.american.toFractional(225).simplify(); // (9/4)

odds.american.toFractional(-125).simplify(); // (4/5)