@lyxa.ai/core 1.2.87 → 1.2.88
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/dist/types/README.md
CHANGED
package/dist/types/package.json
CHANGED
|
@@ -6,7 +6,12 @@ const getRoundBaseCurrencyStage = (value) => {
|
|
|
6
6
|
$cond: [
|
|
7
7
|
{ $ne: [value, null] },
|
|
8
8
|
{
|
|
9
|
-
$
|
|
9
|
+
$multiply: [
|
|
10
|
+
{
|
|
11
|
+
$floor: [{ $add: [{ $multiply: [value, 100] }, 0.5] }],
|
|
12
|
+
},
|
|
13
|
+
0.01,
|
|
14
|
+
],
|
|
10
15
|
},
|
|
11
16
|
0,
|
|
12
17
|
],
|
|
@@ -20,7 +25,7 @@ const getRoundSecondaryCurrencyStage = (value) => {
|
|
|
20
25
|
{
|
|
21
26
|
$multiply: [
|
|
22
27
|
{
|
|
23
|
-
$
|
|
28
|
+
$floor: [{ $add: [{ $divide: [value, 1000] }, 0.5] }],
|
|
24
29
|
},
|
|
25
30
|
1000,
|
|
26
31
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-pipeline-functions.js","sourceRoot":"/","sources":["utilities/pipelines/common-pipeline-functions.ts"],"names":[],"mappings":";;;AAQO,MAAM,yBAAyB,GAAG,CAAC,KAAU,EAAuB,EAAE;IAC5E,OAAO;QACN,KAAK,EAAE;YACN,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE;YACtB;gBACC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"common-pipeline-functions.js","sourceRoot":"/","sources":["utilities/pipelines/common-pipeline-functions.ts"],"names":[],"mappings":";;;AAQO,MAAM,yBAAyB,GAAG,CAAC,KAAU,EAAuB,EAAE;IAC5E,OAAO;QACN,KAAK,EAAE;YACN,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE;YACtB;gBACC,SAAS,EAAE;oBACV;wBACC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAAC;qBACtD;oBACD,IAAI;iBACJ;aACD;YACD,CAAC;SACD;KACD,CAAC;AACH,CAAC,CAAC;AAfW,QAAA,yBAAyB,6BAepC;AAcK,MAAM,8BAA8B,GAAG,CAAC,KAAU,EAAuB,EAAE;IACjF,OAAO;QACN,KAAK,EAAE;YACN,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE;YACtB;gBACC,SAAS,EAAE;oBACV;wBACC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAAC;qBACrD;oBACD,IAAI;iBACJ;aACD;YACD,CAAC;SACD;KACD,CAAC;AACH,CAAC,CAAC;AAfW,QAAA,8BAA8B,kCAezC","sourcesContent":["/**\n * Rounds a base currency value to 2 decimal places inside an aggregation pipeline.\n *\n * ✅ Use when:\n * - You want to round a monetary value like USD, BDT, etc. to 2 decimals.\n *\n * Example: 123.456 → 123.46\n */\nexport const getRoundBaseCurrencyStage = (value: any): Record<string, any> => {\n\treturn {\n\t\t$cond: [\n\t\t\t{ $ne: [value, null] },\n\t\t\t{\n\t\t\t\t$multiply: [\n\t\t\t\t\t{\n\t\t\t\t\t\t$floor: [{ $add: [{ $multiply: [value, 100] }, 0.5] }],\n\t\t\t\t\t},\n\t\t\t\t\t0.01,\n\t\t\t\t],\n\t\t\t},\n\t\t\t0,\n\t\t],\n\t};\n};\n\n/**\n * Rounds a numeric value to the nearest thousand (secondary currency rounding).\n *\n * ✅ Use when:\n * - You’re working with a secondary currency (e.g., large denomination or summary view)\n * - You want rounding like: 123456 → 123000\n *\n * 🧠 Logic:\n * - Divide by 1000\n * - Round to nearest integer\n * - Multiply back by 1000\n */\nexport const getRoundSecondaryCurrencyStage = (value: any): Record<string, any> => {\n\treturn {\n\t\t$cond: [\n\t\t\t{ $ne: [value, null] },\n\t\t\t{\n\t\t\t\t$multiply: [\n\t\t\t\t\t{\n\t\t\t\t\t\t$floor: [{ $add: [{ $divide: [value, 1000] }, 0.5] }],\n\t\t\t\t\t},\n\t\t\t\t\t1000,\n\t\t\t\t],\n\t\t\t},\n\t\t\t0,\n\t\t],\n\t};\n};\n"]}
|