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 @@
/* /*
Papa Parse Papa Parse
v3.1.3 v3.1.4
https://github.com/mholt/PapaParse https://github.com/mholt/PapaParse
*/ */
(function(global) (function(global)
@ -820,9 +820,9 @@
if (_config.dynamicTyping) if (_config.dynamicTyping)
{ {
var value = _results.data[i][j]; var value = _results.data[i][j];
if (value == "true") if (value === "true" || value === "TRUE")
_results.data[i][j] = true; _results.data[i][j] = true;
else if (value == "false") else if (value === "false" || value === "FALSE")
_results.data[i][j] = false; _results.data[i][j] = false;
else else
_results.data[i][j] = tryParseFloat(value); _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 @@
{ {
"name": "parse", "name": "parse",
"version": "3.1.3", "version": "3.1.4",
"title": "Papa Parse", "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.", "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": [ "keywords": [

2
tests/test-cases.js

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

Loading…
Cancel
Save