Rational numbers (fractions)
Sometimes you want to handle a ratio as its own entity. Yeah, you could downcast to decimal (though on floating point that's really a crime), or encode it as a string, but neither of those really cuts it.
So why not
npm install ratio?
var ratio = require'ratio'half = ratio48half === 0.5 // truehalftoString === '1/2' // trueratio0.02toSring === '1/50'
valueOf()returns numeric form
toString()renders fractional form