neuronix-node 0.9.0 → 1.0.0
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/handlers/expense.js +6 -4
- package/package.json +6 -3
package/dist/handlers/expense.js
CHANGED
|
@@ -120,8 +120,8 @@ async function handleExpenseReport(task) {
|
|
|
120
120
|
`Top Categories:`,
|
|
121
121
|
...sortedCategories.slice(0, 10).map((c) => ` ${c.category}: ${fmtCurrency(c.total)} (${c.percentage}%) — ${c.count} items`),
|
|
122
122
|
``,
|
|
123
|
-
`Largest expense: ${sorted[0].description} (${fmtCurrency(sorted[0].amount)})
|
|
124
|
-
`Smallest expense: ${sorted[sorted.length - 1].description} (${fmtCurrency(sorted[sorted.length - 1].amount)})
|
|
123
|
+
...(sorted.length > 0 ? [`Largest expense: ${sorted[0].description} (${fmtCurrency(sorted[0].amount)})`] : []),
|
|
124
|
+
...(sorted.length > 1 ? [`Smallest expense: ${sorted[sorted.length - 1].description} (${fmtCurrency(sorted[sorted.length - 1].amount)})`] : []),
|
|
125
125
|
];
|
|
126
126
|
// ── Build clean CSV output ────────────────────────────────
|
|
127
127
|
const csvLines = [];
|
|
@@ -187,8 +187,10 @@ async function handleExpenseReport(task) {
|
|
|
187
187
|
csvLines.push(`Total Categories,${sortedCategories.length}`);
|
|
188
188
|
if (hasDept)
|
|
189
189
|
csvLines.push(`Total Departments,${sortedDepartments.length}`);
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
if (sorted.length > 0) {
|
|
191
|
+
csvLines.push(`Largest Expense,${csvEscape(sorted[0].description)} (${fmtCurrency(sorted[0].amount)})`);
|
|
192
|
+
csvLines.push(`Average Expense,${fmtCurrency(Math.round((total / expenses.length) * 100) / 100)}`);
|
|
193
|
+
}
|
|
192
194
|
const durationMs = Date.now() - start;
|
|
193
195
|
return {
|
|
194
196
|
text: summaryLines.join("\n"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neuronix-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Neuronix GPU Provider Node — earn by contributing compute to the Neuronix network",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
"build": "tsc",
|
|
11
11
|
"start": "node dist/index.js",
|
|
12
12
|
"dev": "tsx src/index.ts",
|
|
13
|
-
"
|
|
13
|
+
"test": "vitest run",
|
|
14
|
+
"test:watch": "vitest",
|
|
15
|
+
"prepublishOnly": "npm run test && npm run build"
|
|
14
16
|
},
|
|
15
17
|
"files": [
|
|
16
18
|
"dist/**/*",
|
|
@@ -46,6 +48,7 @@
|
|
|
46
48
|
"devDependencies": {
|
|
47
49
|
"@types/node": "^20.0.0",
|
|
48
50
|
"tsx": "^4.0.0",
|
|
49
|
-
"typescript": "^5.0.0"
|
|
51
|
+
"typescript": "^5.0.0",
|
|
52
|
+
"vitest": "^4.1.4"
|
|
50
53
|
}
|
|
51
54
|
}
|