Browse Source

Fix newline option for delimiter autodetect

pull/277/head
jbzorg 9 years ago
parent
commit
cea69b4ac4
  1. 5
      papaparse.js

5
papaparse.js

@ -750,7 +750,7 @@
_delimiterError = false; _delimiterError = false;
if (!_config.delimiter) if (!_config.delimiter)
{ {
var delimGuess = guessDelimiter(input); var delimGuess = guessDelimiter(input, _config.newline);
if (delimGuess.successful) if (delimGuess.successful)
_config.delimiter = delimGuess.bestDelimiter; _config.delimiter = delimGuess.bestDelimiter;
else else
@ -890,7 +890,7 @@
return _results; return _results;
} }
function guessDelimiter(input) function guessDelimiter(input, newline)
{ {
var delimChoices = [',', '\t', '|', ';', Papa.RECORD_SEP, Papa.UNIT_SEP]; var delimChoices = [',', '\t', '|', ';', Papa.RECORD_SEP, Papa.UNIT_SEP];
var bestDelim, bestDelta, fieldCountPrevRow; var bestDelim, bestDelta, fieldCountPrevRow;
@ -903,6 +903,7 @@
var preview = new Parser({ var preview = new Parser({
delimiter: delim, delimiter: delim,
newline: newline,
preview: 10 preview: 10
}).parse(input); }).parse(input);

Loading…
Cancel
Save