Browse Source

use fast mode automatically when safe

pull/139/head
Braden Anderson 10 years ago
parent
commit
e490c8d3f3
  1. 15
      papaparse.js

15
papaparse.js

@ -1012,24 +1012,29 @@
if (!input) if (!input)
return returnable(); return returnable();
if (fastMode) if (fastMode || input.indexOf('"') === -1)
{ {
// Fast mode assumes there are no quoted fields in the input
var rows = input.split(newline); var rows = input.split(newline);
for (var i = 0; i < rows.length; i++) for (var i = 0; i < rows.length; i++)
{ {
if (comments && rows[i].substr(0, commentsLen) == comments) var row = rows[i];
cursor += row.length;
if (i !== rows.length - 1)
cursor += newline.length;
else if (ignoreLastRow)
return returnable();
if (comments && row.substr(0, commentsLen) == comments)
continue; continue;
if (stepIsFunction) if (stepIsFunction)
{ {
data = []; data = [];
pushRow(rows[i].split(delim)); pushRow(row.split(delim));
doStep(); doStep();
if (aborted) if (aborted)
return returnable(); return returnable();
} }
else else
pushRow(rows[i].split(delim)); pushRow(row.split(delim));
if (preview && i >= preview) if (preview && i >= preview)
{ {
data = data.slice(0, preview); data = data.slice(0, preview);

Loading…
Cancel
Save