Browse Source

Dynamic typing converts "TRUE" and "FALSE" to boolean

pull/181/head
Matthew Holt 10 years ago
parent
commit
4efe5b68f9
  1. 4
      papaparse.js
  2. 4
      tests/test-cases.js
  3. 2
      tests/test-runner.js

4
papaparse.js

@ -788,9 +788,9 @@ @@ -788,9 +788,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
tests/test-cases.js

@ -592,10 +592,10 @@ var PARSE_TESTS = [ @@ -592,10 +592,10 @@ var PARSE_TESTS = [
},
{
description: "Dynamic typing converts boolean literals",
input: 'true,false,T,F,TRUE,False',
input: 'true,false,T,F,TRUE,FALSE,True,False',
config: { dynamicTyping: true },
expected: {
data: [[true, false, "T", "F", "TRUE", "False"]],
data: [[true, false, "T", "F", true, false, "True", "False"]],
errors: []
}
},

2
tests/test-runner.js

@ -178,7 +178,7 @@ function compare(actualData, actualErrors, expected) @@ -178,7 +178,7 @@ function compare(actualData, actualErrors, expected)
return {
data: data,
errors: errors
}
};
function compareData(actual, expected)

Loading…
Cancel
Save