Skip to content

Commit

Permalink
Fix/formatted (#10)
Browse files Browse the repository at this point in the history
* fix(classicLambda): updated classicLambda model

* chore(todo): for command output

* build(debug): added model parameter to launch.json

* refactor(model): minor changes to classicLambda

* fix(parse): added ability to parse arrays

* docs(models): added classicLambda documentation

* refactor(hargassnerTelnet): removed unnessacary import

* fix(formatted): formattet output not showing [object] anymore
  • Loading branch information
Florian7843 authored Sep 12, 2021
1 parent c9251e7 commit 59e658d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/bin/hgjson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ client.on('data', (data) => {
array = Object.assign({}, array)
}

string = argv.formatted ? array : JSON.stringify(array)
string = JSON.stringify(array, null, argv.formatted ? 2 : 0)
} else {
// --array option is not specified

// TODO: output data formatted via JSON.strigify(data, null, 2) as output shows [object]
// if formatted or raw is set output data as is, otherwise stringify
string = argv.formatted || argv.raw ? data : JSON.stringify(data)
// if --raw, then output as is, otherwise stringify. if --formatted then intent otherwise don't
if (argv.raw) string = data
else string = JSON.stringify(data, null, argv.formatted ? 2 : 0)
}

console.log(string)
Expand Down

0 comments on commit 59e658d

Please sign in to comment.