diff --git a/papaparse.js b/papaparse.js index 5f670bd..1c3f466 100755 --- a/papaparse.js +++ b/papaparse.js @@ -1113,6 +1113,10 @@ header = header.trim(); } + if (_config.lowercaseHeaders) { + header = header.toLowerCase(); + } + _fields.push(header); } _results.data.splice(0, 1); diff --git a/tests/test-cases.js b/tests/test-cases.js index ad0d9a5..0400123 100644 --- a/tests/test-cases.js +++ b/tests/test-cases.js @@ -733,6 +733,15 @@ var PARSE_TESTS = [ errors: [] } }, + { + description: "Header rows are lowercase when lowercaseHeader is set", + input: 'A,b\r\na,b', + config: { header: true, lowercaseHeaders: true }, + expected: { + data: [{"a": "a", "b": "b"}], + errors: [] + } + }, { description: "Line ends with quoted field, first field of next line is empty using headers", input: 'a,b,"c"\r\nd,e,"f"\r\n,"h","i"\r\n,"k","l"',