json-2-csv
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -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? |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
156
0
19810
6
234
1