From 2fad9cc2d261e7197d24eb2c83dc3ada0dd4be66 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Tue, 5 Dec 2023 22:22:00 +0200 Subject: [PATCH] bugfix to string formatting --- @types/Client.ts | 2 +- src/client/components/LocaleLoader.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/@types/Client.ts b/@types/Client.ts index f511ede..5eed04b 100644 --- a/@types/Client.ts +++ b/@types/Client.ts @@ -42,7 +42,7 @@ export type DiscordStruct = { } export type FormatParams = { - [key: string]: string | number | boolean | undefined + [key: string]: string | number | boolean | undefined | null } export type FormatOpts = { diff --git a/src/client/components/LocaleLoader.ts b/src/client/components/LocaleLoader.ts index 2c8c3fa..438e22c 100644 --- a/src/client/components/LocaleLoader.ts +++ b/src/client/components/LocaleLoader.ts @@ -59,7 +59,7 @@ class LocaleLoader for (const [ parameter, value ] of Object.entries(parameters)) { - if (!value) + if (typeof value === 'undefined' || value === null) continue; string = string.replace(new RegExp(Util.escapeRegex(`{${parameter.toLowerCase()}}`), 'giu'), value.toString()); }