Skip to content

Commit

Permalink
Don't lowercase value if not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
jolzee committed Mar 26, 2020
1 parent 81ebd59 commit 9f0e96f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/utils/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ const generateHeaders = additionalHeaders => {
};

const getCorrectType = val => {
val = val.trim().toLowerCase();
val = val === 'true' || (val === 'false' ? false : val); //
if (typeof val === 'boolean') {
return val;
let temp = val.trim().toLowerCase();
temp = temp === 'true' || (temp === 'false' ? false : val.trim()); //
if (typeof temp === 'boolean') {
return temp;
}
if (/^\d+$/.test(val)) {
if (/^\d+$/.test(temp)) {
// is number
return parseInt(val, 16);
return parseInt(temp, 16);
} else {
return val;
return temp;
}
};

Expand Down

0 comments on commit 9f0e96f

Please sign in to comment.