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

Commit 096f013

Browse files
author
Shammamah Hossain
committed
Use unary plus to convert to number.
1 parent cb9f69b commit 096f013

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/components/Input.react.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,8 @@ export default class Input extends PureComponent {
9393
}
9494

9595
getValueAsNumber(value) {
96-
let intVal = parseInt(value, 10);
97-
let floatVal = parseFloat(value);
98-
99-
return intVal == floatVal ? intVal : floatVal;
96+
const numericValue = convert(value);
97+
return numericValue % 1 === 0 ? Math.floor(numericValue) : numericValue;
10098
}
10199

102100
setInputValue(base, value) {

0 commit comments

Comments
 (0)