Browse Source

handle empty quoted field at EOF

pull/239/head
Braden Anderson 10 years ago
parent
commit
69eeb71df6
  1. 2
      papaparse.js
  2. 8
      tests/test-cases.js

2
papaparse.js

@ -1201,7 +1201,7 @@ @@ -1201,7 +1201,7 @@
{
if (ignoreLastRow)
return returnable();
if (!value)
if (typeof value === 'undefined')
value = input.substr(cursor);
row.push(value);
cursor = inputLen; // important in case parsing is paused

8
tests/test-cases.js

@ -219,6 +219,14 @@ var CORE_PARSER_TESTS = [ @@ -219,6 +219,14 @@ var CORE_PARSER_TESTS = [
errors: []
}
},
{
description: "Empty quoted field at EOF is empty",
input: 'a,b,""\na,b,""',
expected: {
data: [['a', 'b', ''], ['a', 'b', '']],
errors: []
}
},
{
description: "Multiple consecutive empty fields",
input: 'a,b,,,c,d\n,,e,,,f',

Loading…
Cancel
Save