Socket
Socket
Sign inDemoInstall

json-2-csv

Package Overview
Dependencies
Maintainers
1
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-2-csv - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

.npmignore

3

lib/converter.js

@@ -11,3 +11,4 @@ 'use strict';

FIELD : ',',
ARRAY : ';'
ARRAY : ';',
WRAP : ''
},

@@ -14,0 +15,0 @@ EOL : '\n',

@@ -18,3 +18,3 @@ 'use strict';

} else {
subKeys[indx] = newKey; // Set the key name since we don't have a sub document
subKeys[indx] = (options.DELIMITER.WRAP || '') + (newKey || '') + (options.DELIMITER.WRAP || ''); // Set the key name since we don't have a sub document
}

@@ -53,5 +53,5 @@ });

} else if (typeof value === 'object' && value !== null && typeof value.length === 'number') { // We have an array of values
output.push('[' + value.join(options.DELIMITER.ARRAY) + ']');
output.push((options.DELIMITER.WRAP || '') + '[' + value.join(options.DELIMITER.ARRAY) + ']' + (options.DELIMITER.WRAP || ''));
} else {
output.push(value); // Otherwise push the current value
output.push((options.DELIMITER.WRAP || '') + (value || '') + (options.DELIMITER.WRAP || '')); // Otherwise push the current value
}

@@ -58,0 +58,0 @@ }

@@ -5,3 +5,3 @@ {

"description": "A JSON to CSV and CSV to JSON converter that natively supports sub-documents and auto-generates the CSV heading.",
"version": "0.1.3",
"version": "0.1.4",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",

@@ -36,2 +36,3 @@ # Convert JSON to CSV or CSV to JSON

* `ARRAY` - String - Array Value Delimiter. Default: `';'`
* `WRAP` - String - Wrap values in the delimiter of choice (e.g. wrap values in quotes). Default: `''`
* `EOL` - String - End of Line Delimiter. Default: `'\n'`

@@ -50,3 +51,3 @@ * `PARSE_CSV_NUMBERS` - Boolean - Should numbers that are found in the CSV be converted to numbers? Default: `false`

Model: 'Murano',
Year: '2013'
Year: '2013',
Specifications: {

@@ -156,2 +157,2 @@ Mileage: '7106',

- Respect nested arrays when in json2csv - Currently flattens them
- If quotes in CSV header, strip them? Add as an option?
- If quotes in CSV header, strip them? Add as an option?
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