Browse Source

Convert "TRUE"/"FALSE" to boolean with dynamicTyping; fixes #108

pull/124/head 3.1.4
Matthew Holt 10 years ago
parent
commit
2caa971ef6
  1. 6
      papaparse.js
  2. 4
      papaparse.min.js
  3. 2
      parse.jquery.json
  4. 2
      tests/test-cases.js

6
papaparse.js

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/*
Papa Parse
v3.1.3
v3.1.4
https://github.com/mholt/PapaParse
*/
(function(global)
@ -820,9 +820,9 @@ @@ -820,9 +820,9 @@
if (_config.dynamicTyping)
{
var value = _results.data[i][j];
if (value == "true")
if (value === "true" || value === "TRUE")
_results.data[i][j] = true;
else if (value == "false")
else if (value === "false" || value === "FALSE")
_results.data[i][j] = false;
else
_results.data[i][j] = tryParseFloat(value);

4
papaparse.min.js vendored

File diff suppressed because one or more lines are too long

2
parse.jquery.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "parse",
"version": "3.1.3",
"version": "3.1.4",
"title": "Papa Parse",
"description": "Powerful CSV parser that converts CSV to JSON and JSON to CSV. Supports web workers and streaming large files. Gracefully handles malformed input.",
"keywords": [

2
tests/test-cases.js

@ -254,7 +254,7 @@ var PARSE_TESTS = [ @@ -254,7 +254,7 @@ var PARSE_TESTS = [
input: 'true,false,T,F,TRUE,False',
config: { dynamicTyping: true },
expected: {
data: [[true, false, "T", "F", "TRUE", "False"]],
data: [[true, false, "T", "F", true, "False"]],
errors: []
}
},

Loading…
Cancel
Save