experimental: misc ergonomic checking

This commit is contained in:
zkldi
2022-05-06 04:16:23 +01:00
parent ba50d17846
commit 3f4a582ad7
13 changed files with 94 additions and 61 deletions
+2 -2
View File
@@ -80,7 +80,7 @@ export async function UpdateClassIfGreater(
});
if (isGreater === null) {
EmitWebhookEvent({
void EmitWebhookEvent({
type: "class-update/v1",
content: { userID, new: classVal, old: null, set: classSet, game, playtype },
});
@@ -88,7 +88,7 @@ export async function UpdateClassIfGreater(
return null;
}
EmitWebhookEvent({
void EmitWebhookEvent({
type: "class-update/v1",
content: {
userID,
+1 -1
View File
@@ -195,7 +195,7 @@ export async function GetRecentlyAchievedGoals(
goalID: { $in: goalSubs.map((e) => e.goalID) },
});
if (goals.length !== goals.length) {
if (goals.length !== goalSubs.length) {
logger.error(
`Found ${goals.length} goals when looking for parents of ${goalSubs.length} subscriptions. This mismatch implies a state desync.`
);
+4 -1
View File
@@ -11,7 +11,10 @@ export function ParseEA3SoftID(ver: string) {
return {
model: a[0],
dest: a[1], // region
// region
dest: a[1],
spec: a[2],
rev: a[3],
ext: a[4],
+7 -3
View File
@@ -135,11 +135,11 @@ export function IsValidURL(string: string) {
}
export function Sleep(ms: number) {
return new Promise<void>((resolve) =>
return new Promise<void>((resolve) => {
setTimeout(() => {
resolve();
}, ms)
);
}, ms);
});
}
export function GetTimeXHoursAgo(hours: integer) {
@@ -228,3 +228,7 @@ export function IsSupported(game: Game) {
export function ArrayDiff<T>(left: Array<T>, right: Array<T>) {
return right.filter((e) => !left.includes(e));
}
export function IsNonEmptyString(maybeStr: string | null | undefined): maybeStr is string {
return Boolean(maybeStr);
}