Browse Source

Modified the GuessDelimiter function.

Changed the GuessDelimiter function, so that a new delimiter is chosen as best if its delta value is higher than the current highest.
Added a testcase for decimal values with comma as decimal separator and pipes as delimiter.

But i couldnt ran the tests as i dont have a node interpreter installed, so i am not sure if the other tests dont break now.
pull/593/head
Erik-HH 6 years ago committed by GitHub
parent
commit
0c48be5e7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      papaparse.js
  2. 2155
      test-cases.js

4
papaparse.js

@ -1262,7 +1262,7 @@ if (!Array.isArray) @@ -1262,7 +1262,7 @@ if (!Array.isArray)
if (typeof fieldCountPrevRow === 'undefined')
{
fieldCountPrevRow = fieldCount;
fieldCountPrevRow = 0;
continue;
}
else if (fieldCount > 1)
@ -1275,7 +1275,7 @@ if (!Array.isArray) @@ -1275,7 +1275,7 @@ if (!Array.isArray)
if (preview.data.length > 0)
avgFieldCount /= (preview.data.length - emptyLinesCount);
if ((typeof bestDelta === 'undefined' || delta < bestDelta)
if ((typeof bestDelta === 'undefined' || delta > bestDelta)
&& avgFieldCount > 1.99)
{
bestDelta = delta;

2155
test-cases.js

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save