Clean up some things

This commit is contained in:
Ken-Håvard Lieng 2018-05-25 04:12:02 +02:00
parent e2a895a1b9
commit e7cff1686e
9 changed files with 121 additions and 135 deletions

View file

@ -122,18 +122,11 @@ export function isValidUsername(username) {
return true;
}
export function isInt(str, min, max) {
if (!str || str < min || str > max) {
export function isInt(i, min, max) {
if (i < min || i > max || Math.floor(i) !== i) {
return false;
}
for (let i = 0; i < str.length; i++) {
const char = str.charCodeAt(i);
if (char < 48 || char > 57) {
return false;
}
}
return true;
}