settings/utils/calculateApiUsage.js

11 lines
209 B
JavaScript
Raw Normal View History

2024-07-30 11:26:42 +00:00
function calculateApiUsage(price, billingUnit, usage, billingBy) {
const total_cost = (+usage / +billingUnit) * parseFloat(price)
2024-07-30 11:26:42 +00:00
return total_cost.toFixed(10)
}
module.exports = calculateApiUsage