Browse Source

Remove tryParseFloat function

Since 3dbe4c92, this function does not only try to convert float values
but also converts empty string as null. Indeed its better to join this
functionality on the existing parseDynamic function which manages the
typing of all fields.
pull/471/head
Sergi Almacellas Abellana 7 years ago
parent
commit
ce6908745c
  1. 14
      papaparse.js

14
papaparse.js

@ -990,8 +990,12 @@ @@ -990,8 +990,12 @@
return true;
else if (value === 'false' || value === 'FALSE')
return false;
else
return tryParseFloat(value);
else if(FLOAT.test(value)) {
return parseFloat(value);
}
else {
return (value === '' ? null : value);
}
}
return value;
}
@ -1120,12 +1124,6 @@ @@ -1120,12 +1124,6 @@
return numWithN >= r.length / 2 ? '\r\n' : '\r';
}
function tryParseFloat(val)
{
var isNumber = FLOAT.test(val);
return isNumber ? parseFloat(val) : (val === '' ? null : val);
}
function addError(type, code, msg, row)
{
_results.errors.push({

Loading…
Cancel
Save