Clean up some things
This commit is contained in:
parent
e2a895a1b9
commit
e7cff1686e
9 changed files with 121 additions and 135 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue