diff --git a/server/src/core/user-core.ts b/server/src/core/user-core.ts index d45100b1e..39bfaf17b 100644 --- a/server/src/core/user-core.ts +++ b/server/src/core/user-core.ts @@ -75,7 +75,7 @@ export function PRIVATEINFO_GetUserWithID(userID: integer) { export function ResolveUser(usernameOrID: string) { // user ID passed if (usernameOrID.match(/^[0-9]$/)) { - let intID = parseInt(usernameOrID, 10); + let intID = Number(usernameOrID); return db.users.findOne( { diff --git a/server/src/score-import/framework/core/string-asserts.ts b/server/src/score-import/framework/core/string-asserts.ts index af3c2afd3..fb38cb87d 100644 --- a/server/src/score-import/framework/core/string-asserts.ts +++ b/server/src/score-import/framework/core/string-asserts.ts @@ -9,7 +9,7 @@ export function AssertStrAsPositiveInt(strVal: string, errorMessage: string) { throw new InvalidScoreFailure(`${errorMessage} (Not an integer.)`); } - let val = parseInt(strVal, 10); + let val = Number(strVal); if (Number.isNaN(val)) { throw new InvalidScoreFailure(`${errorMessage} (Not a number.)`); @@ -29,7 +29,7 @@ export function AssertStrAsPositiveNonZeroInt(strVal: string, errorMessage: stri throw new InvalidScoreFailure(`${errorMessage} (Not an integer.)`); } - let val = parseInt(strVal, 10); + let val = Number(strVal); if (Number.isNaN(val)) { throw new InvalidScoreFailure(`${errorMessage} (Not a number.)`);