papaparse: add transformHeader option (#36415)

Version 5 introduces a new option `transformHeader`.

See https://www.papaparse.com/docs#config
This commit is contained in:
Dobes Vandermeer 2019-07-02 09:42:07 -07:00 committed by Ryan Cavanaugh
parent cf258953db
commit 03f488cc2f
2 changed files with 6 additions and 2 deletions

View File

@ -1,4 +1,4 @@
// Type definitions for PapaParse v4.5
// Type definitions for PapaParse v5.0
// Project: https://github.com/mholt/PapaParse
// Definitions by: Pedro Flemming <https://github.com/torpedro>
// Rain Shen <https://github.com/rainshen49>
@ -110,6 +110,7 @@ export interface ParseConfig {
chunk?(results: ParseResult, parser: Parser): void; // default: undefined
beforeFirstChunk?(chunk: string): string | void; // default: undefined
transform?(value: string, field: string | number): any; // default: undefined
transformHeader?(header: string): string; // default: undefined
}
export interface UnparseConfig {

View File

@ -45,7 +45,10 @@ var file = new File(null, null, null);
Papa.parse(file, {
transform: function(value, field) {},
complete: function(a, b) {
transformHeader: function(header) {
return header;
},
complete: function (a, b) {
a.meta.fields;
b.name;
},