@@ -6,7 +6,7 @@ import { excelBOM, errors } from './constants';
66import * as utils from './utils' ;
77import type { FullJson2CsvOptions , Json2CsvParams } from './types' ;
88
9- export const Json2Csv = function ( options : FullJson2CsvOptions ) {
9+ export const Json2Csv = function ( options : FullJson2CsvOptions ) {
1010 const wrapDelimiterCheckRegex = new RegExp ( options . delimiter . wrap , 'g' ) ,
1111 crlfSearchRegex = / \r ? \n | \r / ,
1212 customValueParser = options . parseValue && typeof options . parseValue === 'function' ? options . parseValue : null ,
@@ -58,8 +58,8 @@ export const Json2Csv = function(options: FullJson2CsvOptions) {
5858 function checkSchemaDifferences ( documentSchemas : string [ ] [ ] ) {
5959 // have multiple documents - ensure only one schema (regardless of field ordering)
6060 const firstDocSchema = documentSchemas [ 0 ] ,
61- restOfDocumentSchemas = documentSchemas . slice ( 1 ) ,
62- schemaDifferences = computeNumberOfSchemaDifferences ( firstDocSchema , restOfDocumentSchemas ) ;
61+ restOfDocumentSchemas = documentSchemas . slice ( 1 ) ,
62+ schemaDifferences = computeNumberOfSchemaDifferences ( firstDocSchema , restOfDocumentSchemas ) ;
6363
6464 // If there are schema inconsistencies, throw a schema not the same error
6565 if ( schemaDifferences ) {
@@ -134,7 +134,7 @@ export const Json2Csv = function(options: FullJson2CsvOptions) {
134134 function wrapHeaderFields ( params : Json2CsvParams ) {
135135 // only perform this if we are actually prepending the header
136136 if ( options . prependHeader ) {
137- params . headerFields = params . headerFields . map ( function ( headingKey ) {
137+ params . headerFields = params . headerFields . map ( function ( headingKey ) {
138138 return wrapFieldValueIfNecessary ( headingKey ) ;
139139 } ) ;
140140 }
@@ -149,13 +149,13 @@ export const Json2Csv = function(options: FullJson2CsvOptions) {
149149 const fieldTitleMapKeys = Object . keys ( options . fieldTitleMap ) ;
150150
151151 params . header = params . headerFields
152- . map ( function ( field ) {
152+ . map ( function ( field ) {
153153 let headerKey = field ;
154154
155155 // If a custom field title was provided for this field, use that
156156 if ( fieldTitleMapKeys . includes ( field ) ) {
157157 headerKey = options . fieldTitleMap [ field ] ;
158- } else if ( ! options . escapeHeaderNestedDots ) {
158+ } else if ( ! options . escapeHeaderNestedDots ) {
159159 // Otherwise, if the user doesn't want nested dots in keys to be escaped, then unescape them
160160 headerKey = headerKey . replace ( / \\ \. / g, '.' ) ;
161161 }
@@ -188,7 +188,7 @@ export const Json2Csv = function(options: FullJson2CsvOptions) {
188188 } else if ( item ?. wildcardMatch ) {
189189 // Return "field" value for objects with wildcardMatch: true
190190 return item . field ;
191- }
191+ }
192192 // Exclude other objects
193193 return [ ] ;
194194 } ) ;
@@ -206,7 +206,7 @@ export const Json2Csv = function(options: FullJson2CsvOptions) {
206206
207207 if ( options . keys ) {
208208 options . keys = keyStrings ;
209-
209+
210210 const matchedKeys = keyStrings . flatMap ( ( userProvidedKey ) => {
211211 // If this is not a wildcard matched key, then just return and include it in the resulting key list
212212 if ( ! wildcardMatchKeys . includes ( userProvidedKey ) ) {
0 commit comments