json-2-csv
Advanced tools
Comparing version 3.16.1 to 3.17.0
@@ -117,3 +117,6 @@ export interface ISharedOptions { | ||
*/ | ||
parseValue?: (fieldValue: any) => string; | ||
parseValue?: ( | ||
fieldValue: any, | ||
defaultParser: (fieldValue: any) => string | ||
) => string; | ||
} | ||
@@ -120,0 +123,0 @@ |
@@ -11,3 +11,3 @@ 'use strict'; | ||
crlfSearchRegex = /\r?\n|\r/, | ||
valueParserFn = options.parseValue && typeof options.parseValue === 'function' ? options.parseValue : recordFieldValueToString, | ||
customValueParser = options.parseValue && typeof options.parseValue === 'function' ? options.parseValue : null, | ||
expandingWithoutUnwinding = options.expandArrayObjects && !options.unwindArrays, | ||
@@ -255,3 +255,3 @@ deeksOptions = { | ||
fieldValue = trimRecordFieldValue(fieldValue); | ||
fieldValue = valueParserFn(fieldValue); | ||
fieldValue = customValueParser ? customValueParser(fieldValue, recordFieldValueToString) : recordFieldValueToString(fieldValue); | ||
fieldValue = preventCsvInjection(fieldValue); | ||
@@ -258,0 +258,0 @@ fieldValue = wrapFieldValueIfNecessary(fieldValue); |
@@ -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.16.1", | ||
"version": "3.17.0", | ||
"homepage": "https://mrodrig.github.io/json-2-csv", | ||
@@ -11,0 +11,0 @@ "repository": { |
@@ -94,3 +94,3 @@ # 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`. | ||
* `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`. The built-in parsing method is provided as the second argument for cases where default parsing is preferred. | ||
* Default: A built-in method is used to parse out a variety of different value types to well-known formats. | ||
@@ -97,0 +97,0 @@ * Note: Using this option may override other options, including `useDateIso8601Format` and `useLocaleFormat`. |
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
68981
1255