Created
December 13, 2016 15:35
-
-
Save benjaminparnell/cf1c3c05ddc391075365ef5b036dfac4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mlcm = require('mlcm') | |
, frac = require('frac') | |
module.exports = function getMultiplier (prizes) { | |
if (prizes.length === 0) return 0 | |
if (Array.isArray(prizes) === false) throw new Error('getMultiplier requires an array') | |
return mlcm(prizes.map(function (prize) { | |
return frac(prize.chance, Infinity)[2] | |
})) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment