UNPKG

proportion

Version:

Simple package for calculating proportion

26 lines (17 loc) 425 B
module.exports = { data: {}, of: function(num) { this.data.for = parseFloat(num); return this; }, if: function(num) { this.data.if = parseFloat(num); return this; }, equals: function(num) { this.data.equals = parseFloat(num); var result = this.data.for * this.data.equals / this.data.if; this.data = {}; return result; } }