Change /:ugpt to retrieve all ranking infos

This commit is contained in:
zkldi
2021-09-02 15:59:54 +01:00
parent dce6b6e20a
commit 3b03f1c506
2 changed files with 25 additions and 3 deletions
+8 -1
View File
@@ -1,6 +1,6 @@
import crypto from "crypto";
import { ServerTypeInfo } from "lib/setup/config";
import { Game, Playtypes, GetGameConfig } from "tachi-common";
import { Game, Playtypes, GetGameConfig, GamePTConfig } from "tachi-common";
// https://github.com/sindresorhus/escape-string-regexp/blob/main/index.js
// the developer of this has migrated everything to Force ES6 style modules,
@@ -69,6 +69,13 @@ export function IsValidPlaytype(game: Game, str: string): str is Playtypes[Game]
return GetGameConfig(game).validPlaytypes.includes(str as Playtypes[Game]);
}
export function IsValidScoreAlg(
gptConfig: GamePTConfig,
str: unknown
): str is GamePTConfig["scoreRatingAlgs"][0] {
return gptConfig.scoreRatingAlgs.includes(str as GamePTConfig["scoreRatingAlgs"][0]);
}
export function IsString(val: unknown): val is string {
return typeof val === "string";
}