+3
-3
@@ -27,3 +27,3 @@ #!/usr/bin/env node | ||
| } catch (e) { | ||
| console.error("Invalid JSON input"); | ||
| console.error("Invalid JSON input:", e.message); | ||
| process.exit(1); | ||
@@ -37,3 +37,3 @@ } | ||
| } catch (e) { | ||
| console.error("Error parsing the data"); | ||
| console.error("Error parsing the data:", e.message); | ||
| process.exit(2); | ||
@@ -46,5 +46,5 @@ } | ||
| } catch (e) { | ||
| console.error("cannot print the table"); | ||
| console.error("cannot print the table:", e.message); | ||
| process.exit(3); | ||
| } | ||
| })(); |
+2
-2
@@ -15,3 +15,3 @@ const { length } = require("./Utils"); | ||
| structure.forEach(structureItem => { | ||
| const value = data[structureItem.field]; | ||
| const value = structureItem.extractor(data[structureItem.field]); | ||
@@ -25,3 +25,3 @@ if (structureItem.group) { | ||
| } else { | ||
| item[structureItem.key] = structureItem.extractor(value); | ||
| item[structureItem.key] = value; | ||
| } | ||
@@ -28,0 +28,0 @@ |
+6
-0
@@ -123,2 +123,4 @@ const colors = require("colors"); | ||
| formattedValue = moment(formattedValue).format(); | ||
| } else if (typeof formattedValue === "boolean") { | ||
| formattedValue = formattedValue ? "true" : "false"; | ||
| } else if (typeof formattedValue === "number") { | ||
@@ -129,2 +131,6 @@ formattedValue = `${formattedValue}`; | ||
| formattedValue = formattedValue.join("\n"); | ||
| } else if (typeof formattedValue === "object") { | ||
| formattedValue = Object.entries(formattedValue) | ||
| .map(([key, value]) => `${key}: ${value}`) | ||
| .join(", "); | ||
| } | ||
@@ -131,0 +137,0 @@ |
+1
-1
| { | ||
| "name": "2table", | ||
| "version": "0.2.8", | ||
| "version": "0.2.9", | ||
| "description": "Convert JSON to ASCII Table", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
16713
2.07%423
1.44%