Add Tags plugin

This commit is contained in:
Dragory 2018-08-05 01:32:59 +03:00
parent 54b79ca51f
commit 4a1a14be59
6 changed files with 158 additions and 5 deletions

View file

@ -74,8 +74,8 @@ export function stripObjectToScalars(obj, includedNested: string[] = []) {
const stringFormatRegex = /{([^{}]+?)}/g;
export function formatTemplateString(str: string, values) {
return str.replace(stringFormatRegex, (match, val) => {
const value = at(values, val)[0];
return str.replace(stringFormatRegex, (match, prop) => {
const value = at(values, prop)[0];
return typeof value === "string" || typeof value === "number" ? String(value) : "";
});
}