From 43bfd07219afc6abe03f730c65feb99a57fa1e49 Mon Sep 17 00:00:00 2001 From: zkldi Date: Tue, 20 Apr 2021 23:40:18 +0100 Subject: [PATCH] switch parseInt calls for Number calls --- server/src/core/user-core.ts | 2 +- server/src/score-import/framework/core/string-asserts.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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.)`);