json-2-csv
Advanced tools
Comparing version 3.15.1 to 3.16.0
@@ -88,3 +88,3 @@ export interface ISharedOptions { | ||
*/ | ||
sortHeader?: boolean; | ||
sortHeader?: boolean|((a: any, b: any) => number); | ||
@@ -91,0 +91,0 @@ /** |
@@ -106,3 +106,3 @@ 'use strict'; | ||
if (options.sortHeader) { | ||
return fieldNames.sort(); | ||
return typeof options.sortHeader === 'function' ? fieldNames.sort(options.sortHeader) : fieldNames.sort(); | ||
} | ||
@@ -109,0 +109,0 @@ return fieldNames; |
@@ -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.15.1", | ||
"version": "3.16.0", | ||
"homepage": "https://mrodrig.github.io/json-2-csv", | ||
@@ -11,0 +11,0 @@ "repository": { |
@@ -99,3 +99,3 @@ # json-2-csv | ||
* Default: `true` | ||
* `sortHeader` - Boolean - Should the header keys be sorted in alphabetical order? | ||
* `sortHeader` - Boolean or Function - Should the header keys be sorted in alphabetical order? or pass a function to use a custom sorting function | ||
* Default: `false` | ||
@@ -102,0 +102,0 @@ * `trimFieldValues` - Boolean - Should the field values be trimmed? |
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
68742