bugfix to string formatting

This commit is contained in:
Erik 2023-12-05 22:22:00 +02:00
parent b36ec44bb2
commit 2fad9cc2d2
2 changed files with 2 additions and 2 deletions

View File

@ -42,7 +42,7 @@ export type DiscordStruct = {
} }
export type FormatParams = { export type FormatParams = {
[key: string]: string | number | boolean | undefined [key: string]: string | number | boolean | undefined | null
} }
export type FormatOpts = { export type FormatOpts = {

View File

@ -59,7 +59,7 @@ class LocaleLoader
for (const [ parameter, value ] of Object.entries(parameters)) for (const [ parameter, value ] of Object.entries(parameters))
{ {
if (!value) if (typeof value === 'undefined' || value === null)
continue; continue;
string = string.replace(new RegExp(Util.escapeRegex(`{${parameter.toLowerCase()}}`), 'giu'), value.toString()); string = string.replace(new RegExp(Util.escapeRegex(`{${parameter.toLowerCase()}}`), 'giu'), value.toString());
} }