Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 7a828ac

Browse files
author
Marcel Gerber
committed
ValidationUtils improvements
1 parent 8c26631 commit 7a828ac

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/utils/ValidationUtils.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ define(function (require, exports, module) {
3333
* Used to validate whether type of unknown value is an integer.
3434
*
3535
* @param {*} value Value for which to validate its type
36-
* @return {boolean} true if value is an integer
36+
* @return {boolean} true if value is a finite integer
3737
*/
3838
function isInteger(value) {
3939
// Validate value is a number
@@ -42,9 +42,12 @@ define(function (require, exports, module) {
4242
}
4343

4444
// Validate number is an integer
45-
if (value > 0 && Math.floor(value) !== value) {
45+
if (Math.floor(value) !== value) {
4646
return false;
47-
} else if (value < 0 && Math.ceil(value) !== value) {
47+
}
48+
49+
// Validate number is finite
50+
if (!isFinite(value)) {
4851
return false;
4952
}
5053

0 commit comments

Comments
 (0)