@nexim/financial-calculate 1.0.2 → 1.0.4

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 CHANGED
@@ -3,6 +3,16 @@
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.4](https://github.com/the-nexim/nanolib/compare/@nexim/financial-calculate@1.0.3...@nexim/financial-calculate@1.0.4) (2025-08-19)
7
+
8
+ **Note:** Version bump only for package @nexim/financial-calculate
9
+
10
+ ## [1.0.3](https://github.com/the-nexim/nanolib/compare/@nexim/financial-calculate@1.0.2...@nexim/financial-calculate@1.0.3) (2025-06-29)
11
+
12
+ ### Bug Fixes
13
+
14
+ * **financial-document:** remove logger to prevent redundant logs ([efaf5dc](https://github.com/the-nexim/nanolib/commit/efaf5dcbe3c6561689cafc70097fed979c8751e7)) by @
15
+
6
16
  ## [1.0.2](https://github.com/the-nexim/nanolib/compare/@nexim/financial-calculate@1.0.1...@nexim/financial-calculate@1.0.2) (2025-04-27)
7
17
 
8
18
  **Note:** Version bump only for package @nexim/financial-calculate
package/dist/main.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /* @nexim/financial-calculate v1.0.2 */
1
+ /* @nexim/financial-calculate v1.0.4 */
2
2
  "use strict";
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -27,27 +27,21 @@ __export(main_exports, {
27
27
  calculatePercentageProfit: () => calculatePercentageProfit
28
28
  });
29
29
  module.exports = __toCommonJS(main_exports);
30
- var import_logger = require("@alwatr/logger");
31
30
  var import_package_tracer = require("@alwatr/package-tracer");
32
- __dev_mode__: import_package_tracer.packageTracer.add("@nexim/financial-calculate", "1.0.2");
33
- var logger = (0, import_logger.createLogger)("@nexim/financial-calculate");
31
+ __dev_mode__: import_package_tracer.packageTracer.add("@nexim/financial-calculate", "1.0.4");
34
32
  function calculateDiscountedPrice(price, discount, decimal = 2) {
35
- logger.logMethodArgs?.("calculateDiscountedPrice", { price, discount, decimal });
36
33
  const discountedPrice = price * (1 - discount / 100);
37
34
  return parseFloat(discountedPrice.toFixed(decimal));
38
35
  }
39
36
  function calculateDiscountAmount(price, discount, decimal = 2) {
40
- logger.logMethodArgs?.("calculateDiscountAmount", { price, discount, decimal });
41
37
  const discountAmount = price * discount / 100;
42
38
  return parseFloat(discountAmount.toFixed(decimal));
43
39
  }
44
40
  function calculatePercentageProfit(marketPrice, salePrice, decimal = 2) {
45
- logger.logMethodArgs?.("calculatePercentageProfit", { marketPrice, salePrice, decimal });
46
41
  const percentage = (marketPrice - salePrice) / salePrice * 100;
47
42
  return parseFloat(percentage.toFixed(decimal));
48
43
  }
49
44
  function calculatePercentageDiscount(marketPrice, salePrice, decimal = 2) {
50
- logger.logMethodArgs?.("calculatePercentageDiscount", { marketPrice, salePrice, decimal });
51
45
  const percentage = (marketPrice - salePrice) / marketPrice * 100;
52
46
  return parseFloat(percentage.toFixed(decimal));
53
47
  }
package/dist/main.cjs.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/main.ts"],
4
- "sourcesContent": ["import { createLogger } from '@alwatr/logger';\nimport { packageTracer } from '@alwatr/package-tracer';\n\n__dev_mode__: packageTracer.add(__package_name__, __package_version__);\n\nconst logger = createLogger(__package_name__);\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": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA6B;AAC7B,4BAA8B;AAE9B,aAAc,qCAAc,IAAI,8BAAkB,OAAmB;AAErE,IAAM,aAAS,4BAAa,4BAAgB;AAcrC,SAAS,yBAAyB,OAAe,UAAkB,UAAU,GAAW;AAC7F,SAAO,gBAAgB,4BAA4B,EAAE,OAAO,UAAU,QAAQ,CAAC;AAE/E,QAAM,kBAAkB,SAAS,IAAI,WAAW;AAChD,SAAO,WAAW,gBAAgB,QAAQ,OAAO,CAAC;AACpD;AAcO,SAAS,wBAAwB,OAAe,UAAkB,UAAU,GAAW;AAC5F,SAAO,gBAAgB,2BAA2B,EAAE,OAAO,UAAU,QAAQ,CAAC;AAE9E,QAAM,iBAAkB,QAAQ,WAAY;AAC5C,SAAO,WAAW,eAAe,QAAQ,OAAO,CAAC;AACnD;AAeO,SAAS,0BAA0B,aAAqB,WAAmB,UAAU,GAAW;AACrG,SAAO,gBAAgB,6BAA6B,EAAE,aAAa,WAAW,QAAQ,CAAC;AAEvF,QAAM,cAAe,cAAc,aAAa,YAAa;AAC7D,SAAO,WAAW,WAAW,QAAQ,OAAO,CAAC;AAC/C;AAeO,SAAS,4BAA4B,aAAqB,WAAmB,UAAU,GAAW;AACvG,SAAO,gBAAgB,+BAA+B,EAAE,aAAa,WAAW,QAAQ,CAAC;AAEzF,QAAM,cAAe,cAAc,aAAa,cAAe;AAC/D,SAAO,WAAW,WAAW,QAAQ,OAAO,CAAC;AAC/C;",
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": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA8B;AAE9B,aAAc,qCAAc,IAAI,8BAAkB,OAAmB;AAc9D,SAAS,yBAAyB,OAAe,UAAkB,UAAU,GAAW;AAG7F,QAAM,kBAAkB,SAAS,IAAI,WAAW;AAChD,SAAO,WAAW,gBAAgB,QAAQ,OAAO,CAAC;AACpD;AAcO,SAAS,wBAAwB,OAAe,UAAkB,UAAU,GAAW;AAG5F,QAAM,iBAAkB,QAAQ,WAAY;AAC5C,SAAO,WAAW,eAAe,QAAQ,OAAO,CAAC;AACnD;AAeO,SAAS,0BAA0B,aAAqB,WAAmB,UAAU,GAAW;AAGrG,QAAM,cAAe,cAAc,aAAa,YAAa;AAC7D,SAAO,WAAW,WAAW,QAAQ,OAAO,CAAC;AAC/C;AAeO,SAAS,4BAA4B,aAAqB,WAAmB,UAAU,GAAW;AAGvG,QAAM,cAAe,cAAc,aAAa,cAAe;AAC/D,SAAO,WAAW,WAAW,QAAQ,OAAO,CAAC;AAC/C;",
6
6
  "names": []
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,MAAM,CAK7F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,MAAM,CAK5F;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,MAAM,CAKrG;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,MAAM,CAKvG"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,MAAM,CAK7F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,MAAM,CAK5F;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,MAAM,CAKrG;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,MAAM,CAKvG"}
package/dist/main.mjs CHANGED
@@ -1,27 +1,21 @@
1
- /* @nexim/financial-calculate v1.0.2 */
1
+ /* @nexim/financial-calculate v1.0.4 */
2
2
 
3
3
  // src/main.ts
4
- import { createLogger } from "@alwatr/logger";
5
4
  import { packageTracer } from "@alwatr/package-tracer";
6
- __dev_mode__: packageTracer.add("@nexim/financial-calculate", "1.0.2");
7
- var logger = createLogger("@nexim/financial-calculate");
5
+ __dev_mode__: packageTracer.add("@nexim/financial-calculate", "1.0.4");
8
6
  function calculateDiscountedPrice(price, discount, decimal = 2) {
9
- logger.logMethodArgs?.("calculateDiscountedPrice", { price, discount, decimal });
10
7
  const discountedPrice = price * (1 - discount / 100);
11
8
  return parseFloat(discountedPrice.toFixed(decimal));
12
9
  }
13
10
  function calculateDiscountAmount(price, discount, decimal = 2) {
14
- logger.logMethodArgs?.("calculateDiscountAmount", { price, discount, decimal });
15
11
  const discountAmount = price * discount / 100;
16
12
  return parseFloat(discountAmount.toFixed(decimal));
17
13
  }
18
14
  function calculatePercentageProfit(marketPrice, salePrice, decimal = 2) {
19
- logger.logMethodArgs?.("calculatePercentageProfit", { marketPrice, salePrice, decimal });
20
15
  const percentage = (marketPrice - salePrice) / salePrice * 100;
21
16
  return parseFloat(percentage.toFixed(decimal));
22
17
  }
23
18
  function calculatePercentageDiscount(marketPrice, salePrice, decimal = 2) {
24
- logger.logMethodArgs?.("calculatePercentageDiscount", { marketPrice, salePrice, decimal });
25
19
  const percentage = (marketPrice - salePrice) / marketPrice * 100;
26
20
  return parseFloat(percentage.toFixed(decimal));
27
21
  }
package/dist/main.mjs.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/main.ts"],
4
- "sourcesContent": ["import { createLogger } from '@alwatr/logger';\nimport { packageTracer } from '@alwatr/package-tracer';\n\n__dev_mode__: packageTracer.add(__package_name__, __package_version__);\n\nconst logger = createLogger(__package_name__);\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": ";;;AAAA,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAE9B,aAAc,eAAc,IAAI,8BAAkB,OAAmB;AAErE,IAAM,SAAS,aAAa,4BAAgB;AAcrC,SAAS,yBAAyB,OAAe,UAAkB,UAAU,GAAW;AAC7F,SAAO,gBAAgB,4BAA4B,EAAE,OAAO,UAAU,QAAQ,CAAC;AAE/E,QAAM,kBAAkB,SAAS,IAAI,WAAW;AAChD,SAAO,WAAW,gBAAgB,QAAQ,OAAO,CAAC;AACpD;AAcO,SAAS,wBAAwB,OAAe,UAAkB,UAAU,GAAW;AAC5F,SAAO,gBAAgB,2BAA2B,EAAE,OAAO,UAAU,QAAQ,CAAC;AAE9E,QAAM,iBAAkB,QAAQ,WAAY;AAC5C,SAAO,WAAW,eAAe,QAAQ,OAAO,CAAC;AACnD;AAeO,SAAS,0BAA0B,aAAqB,WAAmB,UAAU,GAAW;AACrG,SAAO,gBAAgB,6BAA6B,EAAE,aAAa,WAAW,QAAQ,CAAC;AAEvF,QAAM,cAAe,cAAc,aAAa,YAAa;AAC7D,SAAO,WAAW,WAAW,QAAQ,OAAO,CAAC;AAC/C;AAeO,SAAS,4BAA4B,aAAqB,WAAmB,UAAU,GAAW;AACvG,SAAO,gBAAgB,+BAA+B,EAAE,aAAa,WAAW,QAAQ,CAAC;AAEzF,QAAM,cAAe,cAAc,aAAa,cAAe;AAC/D,SAAO,WAAW,WAAW,QAAQ,OAAO,CAAC;AAC/C;",
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": ";;;AAAA,SAAS,qBAAqB;AAE9B,aAAc,eAAc,IAAI,8BAAkB,OAAmB;AAc9D,SAAS,yBAAyB,OAAe,UAAkB,UAAU,GAAW;AAG7F,QAAM,kBAAkB,SAAS,IAAI,WAAW;AAChD,SAAO,WAAW,gBAAgB,QAAQ,OAAO,CAAC;AACpD;AAcO,SAAS,wBAAwB,OAAe,UAAkB,UAAU,GAAW;AAG5F,QAAM,iBAAkB,QAAQ,WAAY;AAC5C,SAAO,WAAW,eAAe,QAAQ,OAAO,CAAC;AACnD;AAeO,SAAS,0BAA0B,aAAqB,WAAmB,UAAU,GAAW;AAGrG,QAAM,cAAe,cAAc,aAAa,YAAa;AAC7D,SAAO,WAAW,WAAW,QAAQ,OAAO,CAAC;AAC/C;AAeO,SAAS,4BAA4B,aAAqB,WAAmB,UAAU,GAAW;AAGvG,QAAM,cAAe,cAAc,aAAa,cAAe;AAC/D,SAAO,WAAW,WAAW,QAAQ,OAAO,CAAC;AAC/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.2",
3
+ "version": "1.0.4",
4
4
  "description": "Provides a set of utils to handle common financial operations.",
5
5
  "keywords": [
6
6
  "financial",
@@ -45,18 +45,17 @@
45
45
  "watch": "wireit"
46
46
  },
47
47
  "dependencies": {
48
- "@alwatr/logger": "^5.5.3",
49
48
  "@alwatr/package-tracer": "^5.5.3"
50
49
  },
51
50
  "devDependencies": {
52
51
  "@alwatr/nano-build": "^5.5.3",
53
52
  "@alwatr/type-helper": "^5.4.1",
54
53
  "@nexim/typescript-config": "^2.0.1",
55
- "ava": "^6.2.0",
56
- "typedoc": "^0.28.3",
57
- "typedoc-plugin-markdown": "^4.6.3",
54
+ "ava": "^6.4.1",
55
+ "typedoc": "^0.28.10",
56
+ "typedoc-plugin-markdown": "^4.8.1",
58
57
  "typedoc-plugin-no-inherit": "^1.6.1",
59
- "typescript": "^5.8.3",
58
+ "typescript": "^5.9.2",
60
59
  "wireit": "^0.14.12"
61
60
  },
62
61
  "publishConfig": {
@@ -109,5 +108,5 @@
109
108
  "command": "typedoc"
110
109
  }
111
110
  },
112
- "gitHead": "958e5c52a3b48808a4db41686795f8b1bfbb4b37"
111
+ "gitHead": "e67fe3938015270ff3bb71c5d76334faebc4c142"
113
112
  }