fix: return null for no string in parser (#285)
This commit is contained in:
parent
d70ddd1f53
commit
a8d9d98cf2
1 changed files with 1 additions and 0 deletions
|
@ -10,6 +10,7 @@ export type ParseValue = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export function parseString(str: string, value: 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);
|
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;
|
const re = /\{(?<type>file|url|user)\.(?<prop>\w+)(::(?<mod>\w+))?\}/gi;
|
||||||
|
|
Loading…
Reference in a new issue