@nexim/financial-calculate 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/main.cjs +3 -47
- package/dist/main.cjs.map +1 -1
- package/dist/main.mjs +3 -27
- package/dist/main.mjs.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.0.6](https://github.com/the-nexim/nanolib/compare/@nexim/financial-calculate@1.0.5...@nexim/financial-calculate@1.0.6) (2025-11-22)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @nexim/financial-calculate
|
|
9
|
+
|
|
6
10
|
## [1.0.5](https://github.com/the-nexim/nanolib/compare/@nexim/financial-calculate@1.0.4...@nexim/financial-calculate@1.0.5) (2025-08-30)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @nexim/financial-calculate
|
package/dist/main.cjs
CHANGED
|
@@ -1,48 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
"
|
|
3
|
-
var __defProp = Object.
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/main.ts
|
|
22
|
-
var main_exports = {};
|
|
23
|
-
__export(main_exports, {
|
|
24
|
-
calculateDiscountAmount: () => calculateDiscountAmount,
|
|
25
|
-
calculateDiscountedPrice: () => calculateDiscountedPrice,
|
|
26
|
-
calculatePercentageDiscount: () => calculatePercentageDiscount,
|
|
27
|
-
calculatePercentageProfit: () => calculatePercentageProfit
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(main_exports);
|
|
30
|
-
var import_package_tracer = require("@alwatr/package-tracer");
|
|
31
|
-
__dev_mode__: import_package_tracer.packageTracer.add("@nexim/financial-calculate", "1.0.5");
|
|
32
|
-
function calculateDiscountedPrice(price, discount, decimal = 2) {
|
|
33
|
-
const discountedPrice = price * (1 - discount / 100);
|
|
34
|
-
return parseFloat(discountedPrice.toFixed(decimal));
|
|
35
|
-
}
|
|
36
|
-
function calculateDiscountAmount(price, discount, decimal = 2) {
|
|
37
|
-
const discountAmount = price * discount / 100;
|
|
38
|
-
return parseFloat(discountAmount.toFixed(decimal));
|
|
39
|
-
}
|
|
40
|
-
function calculatePercentageProfit(marketPrice, salePrice, decimal = 2) {
|
|
41
|
-
const percentage = (marketPrice - salePrice) / salePrice * 100;
|
|
42
|
-
return parseFloat(percentage.toFixed(decimal));
|
|
43
|
-
}
|
|
44
|
-
function calculatePercentageDiscount(marketPrice, salePrice, decimal = 2) {
|
|
45
|
-
const percentage = (marketPrice - salePrice) / marketPrice * 100;
|
|
46
|
-
return parseFloat(percentage.toFixed(decimal));
|
|
47
|
-
}
|
|
1
|
+
/** 📦 @nexim/financial-calculate v1.0.6 */
|
|
2
|
+
__dev_mode__: console.debug("📦 @nexim/financial-calculate v1.0.6");
|
|
3
|
+
"use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from==="object"||typeof from==="function"){for(let key of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key)&&key!==except)__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:true}),mod);var main_exports={};__export(main_exports,{calculateDiscountAmount:()=>calculateDiscountAmount,calculateDiscountedPrice:()=>calculateDiscountedPrice,calculatePercentageDiscount:()=>calculatePercentageDiscount,calculatePercentageProfit:()=>calculatePercentageProfit});module.exports=__toCommonJS(main_exports);var import_package_tracer=require("@alwatr/package-tracer");__dev_mode__:import_package_tracer.packageTracer.add("@nexim/financial-calculate","1.0.6");function calculateDiscountedPrice(price,discount,decimal=2){const discountedPrice=price*(1-discount/100);return parseFloat(discountedPrice.toFixed(decimal))}function calculateDiscountAmount(price,discount,decimal=2){const discountAmount=price*discount/100;return parseFloat(discountAmount.toFixed(decimal))}function calculatePercentageProfit(marketPrice,salePrice,decimal=2){const percentage=(marketPrice-salePrice)/salePrice*100;return parseFloat(percentage.toFixed(decimal))}function calculatePercentageDiscount(marketPrice,salePrice,decimal=2){const percentage=(marketPrice-salePrice)/marketPrice*100;return parseFloat(percentage.toFixed(decimal))}
|
|
48
4
|
//# sourceMappingURL=main.cjs.map
|
package/dist/main.cjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts"],
|
|
4
4
|
"sourcesContent": ["import { packageTracer } from '@alwatr/package-tracer';\n\n__dev_mode__: packageTracer.add(__package_name__, __package_version__);\n\n/**\n * Calculate the price after applying a discount.\n *\n * @param price - The original price.\n * @param discount - The discount percentage to apply.\n * @param decimal - The number of decimal places to round to (default is 2).\n *\n * @example\n * ```ts\n * calculateDiscountedPrice(100, 10, 1); // returns 90.0\n * ```\n */\nexport function calculateDiscountedPrice(price: number, discount: number, decimal = 2): number {\n // logger.logMethodArgs?.('calculateDiscountedPrice', { price, discount, decimal });\n\n const discountedPrice = price * (1 - discount / 100);\n return parseFloat(discountedPrice.toFixed(decimal));\n}\n\n/**\n * Calculate the discount amount from the original price.\n *\n * @param price - The original price.\n * @param discount - The discount percentage.\n * @param decimal - The number of decimal places to round to (default is 2).\n *\n * @example\n * ```ts\n * calculateDiscountAmount(100, 10, 1); // returns 10.0\n * ```\n */\nexport function calculateDiscountAmount(price: number, discount: number, decimal = 2): number {\n // logger.logMethodArgs?.('calculateDiscountAmount', { price, discount, decimal });\n\n const discountAmount = (price * discount) / 100;\n return parseFloat(discountAmount.toFixed(decimal));\n}\n\n/**\n * Calculates the discount percentage between the market price and the sale price for profit.\n *\n * @param marketPrice - The original market price of the item.\n * @param salePrice - The sale price of the item.\n * @param decimal - The number of decimal places to round the result to(optional with default value = 2).\n *\n * @example\n * ```ts\n * calculatePercentageProfit(100, 80); // Returns 20.00\n * calculatePercentageProfit(100, 80, 1, false); // Returns 25.0\n * ```\n */\nexport function calculatePercentageProfit(marketPrice: number, salePrice: number, decimal = 2): number {\n // logger.logMethodArgs?.('calculatePercentageProfit', { marketPrice, salePrice, decimal });\n\n const percentage = ((marketPrice - salePrice) / salePrice) * 100;\n return parseFloat(percentage.toFixed(decimal));\n}\n\n/**\n * Calculates the discount percentage between the market price and the sale price for discount.\n *\n * @param marketPrice - The original market price of the item.\n * @param salePrice - The sale price of the item.\n * @param decimal - The number of decimal places to round the result to(optional with default value = 2).\n *\n * @example\n * ```ts\n * calculatePercentageDiscount(100, 80); // Returns 20.00\n * calculatePercentageDiscount(100, 80, 1, false); // Returns 25.0\n * ```\n */\nexport function calculatePercentageDiscount(marketPrice: number, salePrice: number, decimal = 2): number {\n // logger.logMethodArgs?.('calculatePercentageDiscount', { marketPrice, salePrice, decimal });\n\n const percentage = ((marketPrice - salePrice) / marketPrice) * 100;\n return parseFloat(percentage.toFixed(decimal));\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;qqBAAA,+UAA8B,kCAE9B,aAAc,oCAAc,IAAI,6BAAkB,OAAmB,EAc9D,SAAS,yBAAyB,MAAe,SAAkB,QAAU,EAAW,CAG7F,MAAM,gBAAkB,OAAS,EAAI,SAAW,KAChD,OAAO,WAAW,gBAAgB,QAAQ,OAAO,CAAC,CACpD,CAcO,SAAS,wBAAwB,MAAe,SAAkB,QAAU,EAAW,CAG5F,MAAM,eAAkB,MAAQ,SAAY,IAC5C,OAAO,WAAW,eAAe,QAAQ,OAAO,CAAC,CACnD,CAeO,SAAS,0BAA0B,YAAqB,UAAmB,QAAU,EAAW,CAGrG,MAAM,YAAe,YAAc,WAAa,UAAa,IAC7D,OAAO,WAAW,WAAW,QAAQ,OAAO,CAAC,CAC/C,CAeO,SAAS,4BAA4B,YAAqB,UAAmB,QAAU,EAAW,CAGvG,MAAM,YAAe,YAAc,WAAa,YAAe,IAC/D,OAAO,WAAW,WAAW,QAAQ,OAAO,CAAC,CAC/C",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/main.mjs
CHANGED
|
@@ -1,28 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { packageTracer } from "@alwatr/package-tracer";
|
|
5
|
-
__dev_mode__: packageTracer.add("@nexim/financial-calculate", "1.0.5");
|
|
6
|
-
function calculateDiscountedPrice(price, discount, decimal = 2) {
|
|
7
|
-
const discountedPrice = price * (1 - discount / 100);
|
|
8
|
-
return parseFloat(discountedPrice.toFixed(decimal));
|
|
9
|
-
}
|
|
10
|
-
function calculateDiscountAmount(price, discount, decimal = 2) {
|
|
11
|
-
const discountAmount = price * discount / 100;
|
|
12
|
-
return parseFloat(discountAmount.toFixed(decimal));
|
|
13
|
-
}
|
|
14
|
-
function calculatePercentageProfit(marketPrice, salePrice, decimal = 2) {
|
|
15
|
-
const percentage = (marketPrice - salePrice) / salePrice * 100;
|
|
16
|
-
return parseFloat(percentage.toFixed(decimal));
|
|
17
|
-
}
|
|
18
|
-
function calculatePercentageDiscount(marketPrice, salePrice, decimal = 2) {
|
|
19
|
-
const percentage = (marketPrice - salePrice) / marketPrice * 100;
|
|
20
|
-
return parseFloat(percentage.toFixed(decimal));
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
calculateDiscountAmount,
|
|
24
|
-
calculateDiscountedPrice,
|
|
25
|
-
calculatePercentageDiscount,
|
|
26
|
-
calculatePercentageProfit
|
|
27
|
-
};
|
|
1
|
+
/** 📦 @nexim/financial-calculate v1.0.6 */
|
|
2
|
+
__dev_mode__: console.debug("📦 @nexim/financial-calculate v1.0.6");
|
|
3
|
+
import{packageTracer}from"@alwatr/package-tracer";__dev_mode__:packageTracer.add("@nexim/financial-calculate","1.0.6");function calculateDiscountedPrice(price,discount,decimal=2){const discountedPrice=price*(1-discount/100);return parseFloat(discountedPrice.toFixed(decimal))}function calculateDiscountAmount(price,discount,decimal=2){const discountAmount=price*discount/100;return parseFloat(discountAmount.toFixed(decimal))}function calculatePercentageProfit(marketPrice,salePrice,decimal=2){const percentage=(marketPrice-salePrice)/salePrice*100;return parseFloat(percentage.toFixed(decimal))}function calculatePercentageDiscount(marketPrice,salePrice,decimal=2){const percentage=(marketPrice-salePrice)/marketPrice*100;return parseFloat(percentage.toFixed(decimal))}export{calculateDiscountAmount,calculateDiscountedPrice,calculatePercentageDiscount,calculatePercentageProfit};
|
|
28
4
|
//# sourceMappingURL=main.mjs.map
|
package/dist/main.mjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts"],
|
|
4
4
|
"sourcesContent": ["import { packageTracer } from '@alwatr/package-tracer';\n\n__dev_mode__: packageTracer.add(__package_name__, __package_version__);\n\n/**\n * Calculate the price after applying a discount.\n *\n * @param price - The original price.\n * @param discount - The discount percentage to apply.\n * @param decimal - The number of decimal places to round to (default is 2).\n *\n * @example\n * ```ts\n * calculateDiscountedPrice(100, 10, 1); // returns 90.0\n * ```\n */\nexport function calculateDiscountedPrice(price: number, discount: number, decimal = 2): number {\n // logger.logMethodArgs?.('calculateDiscountedPrice', { price, discount, decimal });\n\n const discountedPrice = price * (1 - discount / 100);\n return parseFloat(discountedPrice.toFixed(decimal));\n}\n\n/**\n * Calculate the discount amount from the original price.\n *\n * @param price - The original price.\n * @param discount - The discount percentage.\n * @param decimal - The number of decimal places to round to (default is 2).\n *\n * @example\n * ```ts\n * calculateDiscountAmount(100, 10, 1); // returns 10.0\n * ```\n */\nexport function calculateDiscountAmount(price: number, discount: number, decimal = 2): number {\n // logger.logMethodArgs?.('calculateDiscountAmount', { price, discount, decimal });\n\n const discountAmount = (price * discount) / 100;\n return parseFloat(discountAmount.toFixed(decimal));\n}\n\n/**\n * Calculates the discount percentage between the market price and the sale price for profit.\n *\n * @param marketPrice - The original market price of the item.\n * @param salePrice - The sale price of the item.\n * @param decimal - The number of decimal places to round the result to(optional with default value = 2).\n *\n * @example\n * ```ts\n * calculatePercentageProfit(100, 80); // Returns 20.00\n * calculatePercentageProfit(100, 80, 1, false); // Returns 25.0\n * ```\n */\nexport function calculatePercentageProfit(marketPrice: number, salePrice: number, decimal = 2): number {\n // logger.logMethodArgs?.('calculatePercentageProfit', { marketPrice, salePrice, decimal });\n\n const percentage = ((marketPrice - salePrice) / salePrice) * 100;\n return parseFloat(percentage.toFixed(decimal));\n}\n\n/**\n * Calculates the discount percentage between the market price and the sale price for discount.\n *\n * @param marketPrice - The original market price of the item.\n * @param salePrice - The sale price of the item.\n * @param decimal - The number of decimal places to round the result to(optional with default value = 2).\n *\n * @example\n * ```ts\n * calculatePercentageDiscount(100, 80); // Returns 20.00\n * calculatePercentageDiscount(100, 80, 1, false); // Returns 25.0\n * ```\n */\nexport function calculatePercentageDiscount(marketPrice: number, salePrice: number, decimal = 2): number {\n // logger.logMethodArgs?.('calculatePercentageDiscount', { marketPrice, salePrice, decimal });\n\n const percentage = ((marketPrice - salePrice) / marketPrice) * 100;\n return parseFloat(percentage.toFixed(decimal));\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;AAAA,OAAS,kBAAqB,yBAE9B,aAAc,cAAc,IAAI,6BAAkB,OAAmB,EAc9D,SAAS,yBAAyB,MAAe,SAAkB,QAAU,EAAW,CAG7F,MAAM,gBAAkB,OAAS,EAAI,SAAW,KAChD,OAAO,WAAW,gBAAgB,QAAQ,OAAO,CAAC,CACpD,CAcO,SAAS,wBAAwB,MAAe,SAAkB,QAAU,EAAW,CAG5F,MAAM,eAAkB,MAAQ,SAAY,IAC5C,OAAO,WAAW,eAAe,QAAQ,OAAO,CAAC,CACnD,CAeO,SAAS,0BAA0B,YAAqB,UAAmB,QAAU,EAAW,CAGrG,MAAM,YAAe,YAAc,WAAa,UAAa,IAC7D,OAAO,WAAW,WAAW,QAAQ,OAAO,CAAC,CAC/C,CAeO,SAAS,4BAA4B,YAAqB,UAAmB,QAAU,EAAW,CAGvG,MAAM,YAAe,YAAc,WAAa,YAAe,IAC/D,OAAO,WAAW,WAAW,QAAQ,OAAO,CAAC,CAC/C",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexim/financial-calculate",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Provides a set of utils to handle common financial operations.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"financial",
|
|
@@ -45,17 +45,17 @@
|
|
|
45
45
|
"watch": "wireit"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@alwatr/package-tracer": "^5.5.
|
|
48
|
+
"@alwatr/package-tracer": "^5.5.23"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@alwatr/nano-build": "^6.
|
|
51
|
+
"@alwatr/nano-build": "^6.3.9",
|
|
52
52
|
"@alwatr/type-helper": "^5.4.4",
|
|
53
53
|
"@nexim/typescript-config": "^2.0.1",
|
|
54
54
|
"ava": "^6.4.1",
|
|
55
|
-
"typedoc": "^0.28.
|
|
56
|
-
"typedoc-plugin-markdown": "^4.
|
|
55
|
+
"typedoc": "^0.28.14",
|
|
56
|
+
"typedoc-plugin-markdown": "^4.9.0",
|
|
57
57
|
"typedoc-plugin-no-inherit": "^1.6.1",
|
|
58
|
-
"typescript": "^5.9.
|
|
58
|
+
"typescript": "^5.9.3",
|
|
59
59
|
"wireit": "^0.14.12"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"command": "typedoc"
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "aa1bbda5f949163da8a2e11e658afe02aad75458"
|
|
112
112
|
}
|