@nexim/financial-calculate
Version:
Provides a set of utils to handle common financial operations.
53 lines • 1.88 kB
TypeScript
/**
* Calculate the price after applying a discount.
*
* @param price - The original price.
* @param discount - The discount percentage to apply.
* @param decimal - The number of decimal places to round to (default is 2).
*
* @example
* ```ts
* calculateDiscountedPrice(100, 10, 1); // returns 90.0
* ```
*/
export declare function calculateDiscountedPrice(price: number, discount: number, decimal?: number): number;
/**
* Calculate the discount amount from the original price.
*
* @param price - The original price.
* @param discount - The discount percentage.
* @param decimal - The number of decimal places to round to (default is 2).
*
* @example
* ```ts
* calculateDiscountAmount(100, 10, 1); // returns 10.0
* ```
*/
export declare function calculateDiscountAmount(price: number, discount: number, decimal?: number): number;
/**
* Calculates the profit percentage between the selling price and the cost price.
*
* @param sellingPrice - The selling price of the item.
* @param costPrice - The cost price of the item.
* @param decimal - The number of decimal places to round the result to (default is 2).
*
* @example
* ```ts
* calculatePercentageProfit(100, 80); // Returns 25.00
* ```
*/
export declare function calculatePercentageProfit(sellingPrice: number, costPrice: number, decimal?: number): number;
/**
* Calculates the discount percentage between the market price and the sale price.
*
* @param marketPrice - The original market price of the item.
* @param salePrice - The sale price of the item.
* @param decimal - The number of decimal places to round the result to (default is 2).
*
* @example
* ```ts
* calculatePercentageDiscount(100, 80); // Returns 20.00
* ```
*/
export declare function calculatePercentageDiscount(marketPrice: number, salePrice: number, decimal?: number): number;
//# sourceMappingURL=main.d.ts.map