vsf-utilities
Version:
Utilities functions shared between vsf projects
15 lines • 596 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Create price object with base price and tax
* @param price - product price which is used to extract tax value
* @param rateFactor - tax % in decimal
* @param isPriceInclTax - determines if price already include tax
*/
function createSinglePrice(price, rateFactor, isPriceInclTax) {
const _price = isPriceInclTax ? price / (1 + rateFactor) : price;
const tax = _price * rateFactor;
return { price: _price, tax };
}
exports.default = createSinglePrice;
//# sourceMappingURL=createSinglePrice.js.map