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 3.10.3 to 3.11.0

3

lib/constants.json

@@ -37,3 +37,4 @@ {

"useDateIso8601Format": false,
"useLocaleFormat": false
"useLocaleFormat": false,
"parseValue": null
},

@@ -40,0 +41,0 @@

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

const escapedWrapDelimiterRegex = new RegExp(options.delimiter.wrap + options.delimiter.wrap, 'g'),
excelBOMRegex = new RegExp('^' + constants.values.excelBOM);
excelBOMRegex = new RegExp('^' + constants.values.excelBOM),
valueParserFn = options.parseValue && typeof options.parseValue === 'function' ? options.parseValue : JSON.parse;

@@ -359,3 +360,3 @@ /**

let parsedJson = JSON.parse(value);
let parsedJson = valueParserFn(value);

@@ -362,0 +363,0 @@ // If the parsed value is an array, then we also need to trim record values, if specified

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

crlfSearchRegex = /\r?\n|\r/,
valueParserFn = options.parseValue && typeof options.parseValue === 'function' ? options.parseValue : recordFieldValueToString,
expandingWithoutUnwinding = options.expandArrayObjects && !options.unwindArrays,

@@ -250,3 +251,3 @@ deeksOptions = {

fieldValue = trimRecordFieldValue(fieldValue);
fieldValue = recordFieldValueToString(fieldValue);
fieldValue = valueParserFn(fieldValue);
fieldValue = wrapFieldValueIfNecessary(fieldValue);

@@ -253,0 +254,0 @@

@@ -8,3 +8,3 @@ {

"description": "A JSON to CSV and CSV to JSON converter that natively supports sub-documents and auto-generates the CSV heading.",
"version": "3.10.3",
"version": "3.11.0",
"homepage": "https://mrodrig.github.io/json-2-csv",

@@ -11,0 +11,0 @@ "repository": {

@@ -94,2 +94,5 @@ # json-2-csv

* Key Paths - If you are converting a nested object (ie. {info : {name: 'Mike'}}), then set this to ['info.name']
* `parseValue` - Function - Specify how values should be converted into CSV format. This function is provided a single field value at a time and must return a `String`.
* Default: A built-in method is used to parse out a variety of different value types to well-known formats.
* Note: Using this option may override other options, including `useDateIso8601Format` and `useLocaleFormat`.
* `prependHeader` - Boolean - Should the auto-generated header be prepended as the first line in the CSV?

@@ -165,2 +168,4 @@ * Default: `true`

* If you want all keys to be converted, then specify `null` or don't specify the option to utilize the default.
* `parseValue` - Function - Specify how `String` representations of field values should be parsed when converting back to JSON. This function is provided a single `String` and can return any value.
* Default: `JSON.parse` - An attempt is made to convert the String back to its original value using `JSON.parse`.
* `trimHeaderFields` - Boolean - Should the header fields be trimmed?

@@ -167,0 +172,0 @@ * Default: `false`

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