Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
Use unary plus to convert to number.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shammamah Hossain committed Jan 14, 2020
1 parent cb9f69b commit 096f013
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/components/Input.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,8 @@ export default class Input extends PureComponent {
}

getValueAsNumber(value) {
let intVal = parseInt(value, 10);
let floatVal = parseFloat(value);

return intVal == floatVal ? intVal : floatVal;
const numericValue = convert(value);
return numericValue % 1 === 0 ? Math.floor(numericValue) : numericValue;
}

setInputValue(base, value) {
Expand Down

0 comments on commit 096f013

Please sign in to comment.