Skip to content

Commit 581f159

Browse files
authored
Merge pull request #13 from mrodrig/fix-12
Fix #12
2 parents 9c016ee + a4387e1 commit 581f159

File tree

3 files changed

+57
-23
lines changed

3 files changed

+57
-23
lines changed

bin/utils/utils.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,14 @@ function processOutput(params) {
7878
// Pretty print the output when converting from CSV to JSON
7979
return writeToFile(params.output, JSON.stringify(params.outputData, null, 4));
8080
}
81+
8182
// Otherwise, no output specified, convert to valid JSON string, send to stdout via the console
82-
console.log(JSON.stringify(params.outputData, null, 2)); // eslint-disable-line no-console
83+
if (typeof params.outputData === 'object') { // JSON
84+
console.log(JSON.stringify(params.outputData, null, 2)); // eslint-disable-line no-console
85+
} else { // CSV
86+
console.log(params.outputData);
87+
}
88+
8389
}
8490

8591
function constructKeysList(key, keys) {

package-lock.json

Lines changed: 48 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"author": "mrodrig",
33
"name": "@mrodrig/json-2-csv-cli",
44
"description": "CLI for the json-2-csv package",
5-
"version": "4.0.1",
5+
"version": "4.1.0",
66
"repository": {
77
"type": "git",
88
"url": "https://github.com/mrodrig/json-2-csv-cli.git"
@@ -30,7 +30,7 @@
3030
],
3131
"dependencies": {
3232
"commander": "9.4.1",
33-
"json-2-csv": "^3.17.2"
33+
"json-2-csv": "3.20.0"
3434
},
3535
"engines": {
3636
"node": ">= 12"

0 commit comments

Comments
 (0)