Comparing version 1.0.5 to 1.1.0
@@ -85,3 +85,3 @@ #!/usr/bin/env node | ||
type: 'string', | ||
default: 'idx' | ||
default: 'null' | ||
}), | ||
@@ -99,2 +99,8 @@ yargs.positional('fileout', { | ||
}) | ||
.option('numberedindex', { | ||
alias: 'n', | ||
default: false, | ||
type: 'boolean', | ||
description: 'add index column numbered' | ||
}) | ||
.option('verbose', { | ||
@@ -117,4 +123,6 @@ alias: 'v', | ||
var { idxname, fileout, debug, verbose } = argv; | ||
var { idxname,numberedindex, fileout, debug, verbose } = argv; | ||
if (idxname != "null") numberedindex = true; | ||
if (numberedindex==true && idxname=="null")idxname = "idx"; | ||
@@ -125,3 +133,2 @@ | ||
//Possible later support for .env preconf | ||
@@ -190,12 +197,2 @@ try { | ||
function getCSVLines(data) { | ||
var l=""; | ||
for (const [key, value] of Object.entries(data)) { | ||
var e = ""; | ||
for (const [key2, value2] of Object.entries(value)) { | ||
} | ||
} | ||
return l; | ||
} | ||
function getCSVLinesPTO(data) { | ||
@@ -212,3 +209,5 @@ var h=""; | ||
var c = 0; | ||
ls += key + ","; | ||
var _prestringIndex = key + ","; | ||
if (!numberedindex) _prestringIndex = ""; | ||
ls += _prestringIndex; | ||
@@ -235,3 +234,5 @@ for (const [key2, value2] of Object.entries(value)) { | ||
} | ||
return idxname + ","+ h + "\n" + ls; | ||
var _prestring = idxname + ","; | ||
if (!numberedindex) _prestring = ""; | ||
return _prestring+ h + "\n" + ls; | ||
} | ||
@@ -238,0 +239,0 @@ |
{ | ||
"name": "json2bash", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"description": "A CLI to export json object to bash env. Also json array to csv", | ||
@@ -5,0 +5,0 @@ "main": "json2bash.js", |
@@ -39,2 +39,3 @@ # json2bashenv | ||
```sh | ||
#default (has no index) | ||
jsonarr2csv sample-jsonarr2csv.json >out.csv | ||
@@ -44,2 +45,5 @@ | ||
jsonarr2csv sample-jsonarr2csv.json myindexname >out.csv | ||
#with default index | ||
jsonarr2csv sample-jsonarr2csv.json -d >out.csv | ||
``` | ||
@@ -46,0 +50,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
112763
3270
55