fix: return null for no string in parser (#285)

This commit is contained in:
Jayvin Hernandez 2023-02-16 16:47:07 -08:00 committed by GitHub
parent d70ddd1f53
commit a8d9d98cf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 = /\{(?<type>file|url|user)\.(?<prop>\w+)(::(?<mod>\w+))?\}/gi;