This lib is meant to help you work with odds, for instance in gambling project.
To install use bower or npm
bower install bookmaker --save
npm install bookmakerjs --save
You have at the moment series of methods and you can view their use in test.js
.
Run test:
mocha node_modules/bookmaker/test.js
fractionToPercent(numerator:Number, denomiator:Number) : Number
Return percent as fraction of 1.
fractionToDecimal(numerator:Number, denomiator:Number) : Number
fractionToAmerican(numerator:Number, denomiator:Number) : Number
decimalToFraction(decimal:Number): String
decimalToPercent(decimal:Number): Number
decimalToAmerican(decimal:Number): Number
percentToDecimal(percent:Number): Number
percentToFraction(percent:Number): String
percentToAmerican(percent:Number): Number
americanToDecimal(american:Number): Number
americanToPercent(american:Number): Number
americanToFraction(american:Number): String
winSingle(decimal:Number, money:Number): Number winSingle(any:String, money:Number): Number - see parse function
winEachWaySingle(decimal:Number, placeOdds:Number, moneyWin:Number, moneyPlace:Number): Number winEachWaySingle(any:String, placeOdds:Number, moneyWin:Number, moneyPlace:Number): Number
See test.js
winEachWaySingle(moneyWin:Number, moneyPlace:Number, [decimal:Number, placeOdds:Number], ...): Number
oddsEachWaySingle(winOdds:Any, placeOdds:Any):Object - see test.js
combineOddsEachWAy(list:Array): Object - see test.js
combineOdds(list:array): Number - see test.js
parse(any:String) : Number - decimal
Accepts:
1/4
fracitons50%
percents1:5
odds (: mean divide sign)- numbers as decimals
MIT - just because