From a8d9d98cf2f879300872f782a607d0ffbd95004d Mon Sep 17 00:00:00 2001 From: Jayvin Hernandez Date: Thu, 16 Feb 2023 16:47:07 -0800 Subject: [PATCH] fix: return null for no string in parser (#285) --- src/lib/utils/parser.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/utils/parser.ts b/src/lib/utils/parser.ts index 2d0e366..2827440 100644 --- a/src/lib/utils/parser.ts +++ b/src/lib/utils/parser.ts @@ -10,6 +10,7 @@ export type ParseValue = { }; export function parseString(str: string, value: ParseValue) { + if (!str) return null; str = str.replace(/\{link\}/gi, value.link).replace(/\{raw_link\}/gi, value.raw_link); const re = /\{(?file|url|user)\.(?\w+)(::(?\w+))?\}/gi;