Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mrodrig/json-2-csv-cli

Package Overview
Dependencies
Maintainers
0
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mrodrig/json-2-csv-cli - npm Package Compare versions

Comparing version 5.0.0 to 5.5.4

15

bin/csv2json.js

@@ -12,10 +12,13 @@ #!/usr/bin/env node

.usage('<csvFile> [options]')
.argument('<csvFile>', 'CSV file to convert')
.option('-o, --output [output]', 'Path of output file. If not provided, then stdout will be used', utils.convertToAbsolutePath)
.option('-f, --field <delimiter>', 'Optional field delimiter')
.option('-w, --wrap <delimiter>', 'Optional wrap delimiter')
.option('-e, --eol <delimiter>', 'Optional end of line delimiter')
.option('-f, --field <delimiter>', 'Field delimiter')
.option('-w, --wrap <delimiter>', 'Wrap delimiter')
.option('-e, --eol <delimiter>', 'End of Line delimiter')
.option('-b, --excel-bom', 'Excel Byte Order Mark character prepended to CSV')
.option('-p, --prevent-csv-injection', 'Prevent CSV Injection')
.option('-F, --trim-fields', 'Trim field values')
.option('-H, --trim-header', 'Trim header fields')
.option('-F, --trim-fields', 'Trim field values')
.option('-k, --keys [keys]', 'Keys of documents to convert to CSV', utils.constructKeysList, undefined)
.option('-h, --header-fields', 'Specify the fields names in place a header line in the CSV itself', utils.constructKeysList)
.option('-k, --keys [keys]', 'Keys of documents to convert to CSV', utils.constructKeysList)
.parse(process.argv);

@@ -35,2 +38,4 @@

excelBOM: Boolean(options.excelBom),
headerFields: options.headerFields,
preventCsvInjection: Boolean(options.preventCsvInjection),
trimHeaderFields: Boolean(options.trimHeader),

@@ -37,0 +42,0 @@ trimFieldValues: Boolean(options.trimFields),

@@ -12,16 +12,25 @@ #!/usr/bin/env node

.usage('<jsonFile> [options]')
.argument('<jsonFile>', 'JSON file to convert')
.option('-o, --output [output]', 'Path of output file. If not provided, then stdout will be used', utils.convertToAbsolutePath)
.option('-f, --field <delimiter>', 'Optional field delimiter')
.option('-w, --wrap <delimiter>', 'Optional wrap delimiter')
.option('-e, --eol <delimiter>', 'Optional end of line delimiter')
.option('-a, --array-indexes-as-keys', 'Includes array indexes in the generated keys')
.option('-S, --check-schema', 'Check for schema differences')
.option('-f, --field <delimiter>', 'Field delimiter')
.option('-w, --wrap <delimiter>', 'Wrap delimiter')
.option('-e, --eol <delimiter>', 'End of Line delimiter')
.option('-E, --empty-field-value <value>', 'Empty field value')
.option('-n, --expand-nested-objects', 'Expand nested objects to be deep converted to CSV')
.option('-k, --keys [keys]', 'Keys of documents to convert to CSV', utils.constructKeysList)
.option('-d, --escape-header-nested-dots', 'Escape header nested dots')
.option('-b, --excel-bom', 'Excel Byte Order Mark character prepended to CSV')
.option('-x, --exclude-keys [keys]', 'Comma separated list of keys to exclude', utils.constructKeysList)
.option('-A, --expand-array-objects', 'Expand array objects')
.option('-W, --without-header', 'Withhold the prepended header')
.option('-p, --prevent-csv-injection', 'Prevent CSV Injection')
.option('-s, --sort-header', 'Sort the header fields')
.option('-F, --trim-fields', 'Trim field values')
.option('-H, --trim-header', 'Trim header fields')
.option('-F, --trim-fields', 'Trim field values')
.option('-S, --check-schema', 'Check for schema differences')
.option('-E, --empty-field-value <value>', 'Empty field value')
.option('-A, --expand-array-objects', 'Expand array objects')
.option('-U, --unwind-arrays', 'Unwind array values to their own CSV line')
.option('-k, --keys [keys]', 'Keys of documents to convert to CSV', utils.constructKeysList, undefined)
.option('-I, --iso-date-format', 'Use ISO 8601 date format')
.option('-L, --locale-format', 'Use locale format for values')
.option('-B, --wrap-booleans', 'Wrap booleans')
.parse(process.argv);

@@ -40,4 +49,10 @@

},
arrayIndexesAsKeys: Boolean(options.arrayIndexesAsKeys),
emptyFieldValue: options.emptyFieldValue,
escapeHeaderNestedDots: Boolean(options.escapeHeaderNestedDots),
excelBOM: Boolean(options.excelBom),
excludeKeys: options.excludeKeys,
expandNestedObjects: Boolean(options.expandNestedObjects),
prependHeader: !options.withoutHeader,
preventCsvInjection: Boolean(options.preventCsvInjection),
sortHeader: Boolean(options.sortHeader),

@@ -49,3 +64,5 @@ trimHeaderFields: Boolean(options.trimHeader),

unwindArrays: Boolean(options.unwindArrays),
emptyFieldValue: options.emptyFieldValue,
useDateIso8601Format: Boolean(options.isoDateFormat),
useLocaleFormat: Boolean(options.localeFormat),
wrapBooleans: Boolean(options.wrapBooleans),
keys: options.keys

@@ -52,0 +69,0 @@ }

@@ -87,10 +87,4 @@ 'use strict';

function constructKeysList(key, keys) {
// Initialize as empty array, if undefined at start
if (!keys) {
keys = [];
}
keys.push(key);
return keys;
function constructKeysList(keys) {
return keys.split(',');
}

@@ -5,6 +5,6 @@ {

"description": "CLI for the json-2-csv package",
"version": "5.0.0",
"version": "5.5.4",
"repository": {
"type": "git",
"url": "https://github.com/mrodrig/json-2-csv-cli.git"
"url": "git+https://github.com/mrodrig/json-2-csv-cli.git"
},

@@ -15,4 +15,4 @@ "bugs": {

"bin": {
"json2csv": "./bin/json2csv.js",
"csv2json": "./bin/csv2json.js"
"json2csv": "bin/json2csv.js",
"csv2json": "bin/csv2json.js"
},

@@ -34,4 +34,4 @@ "keywords": [

"dependencies": {
"commander": "11.1.0",
"json-2-csv": "5.0.0"
"commander": "12.1.0",
"json-2-csv": "5.5.4"
},

@@ -38,0 +38,0 @@ "engines": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc