File tree Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Expand file tree Collapse file tree 2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ export const Json2Csv = function(options: FullJson2CsvOptions) {
85
85
return keyPaths . filter ( ( keyPath ) => {
86
86
for ( const excludedKey of options . excludeKeys ) {
87
87
// Only match if the excludedKey appears at the beginning of the string so we don't accidentally match a key farther down in a key path
88
- const regex = new RegExp ( `^${ excludedKey } ` ) ;
88
+ const regex = excludedKey instanceof RegExp ? excludedKey : new RegExp ( `^${ excludedKey } ` ) ;
89
89
90
90
if ( excludedKey === keyPath || keyPath . match ( regex ) ) {
91
91
return false ; // Exclude the key
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ export interface Json2CsvOptions extends SharedConverterOptions {
155
155
/**
156
156
* Specify the keys that should be excluded from the output.
157
157
*/
158
- excludeKeys ?: string [ ] ;
158
+ excludeKeys ?: ( string | RegExp ) [ ] ;
159
159
160
160
/**
161
161
* 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`.
You can’t perform that action at this time.
0 commit comments