@ztimson/utils 0.27.17 → 0.27.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2312,7 +2312,7 @@ ${opts.message || this.desc}`;
|
|
|
2312
2312
|
};
|
|
2313
2313
|
const evaluate = (code, data2, fatal = true) => {
|
|
2314
2314
|
try {
|
|
2315
|
-
return Function("data", `
|
|
2315
|
+
return Function("data", `with(data) { return ${code}; }`)(data2);
|
|
2316
2316
|
} catch {
|
|
2317
2317
|
if (fatal) throw new TemplateError(`Failed to evaluate: ${code}`);
|
|
2318
2318
|
else return false;
|
|
@@ -2348,7 +2348,7 @@ ${opts.message || this.desc}`;
|
|
|
2348
2348
|
content = content.replace(found[0], evaluate(found[1].trim(), d) || "");
|
|
2349
2349
|
}
|
|
2350
2350
|
while (!!(found = /\{\{\s*?>\s*?(.+?):(.+?)\s*?}}([\s\S]*?)\{\{\s*?\/>\s*?}}/g.exec(content))) {
|
|
2351
|
-
content = content.replace(found[0], await renderTemplate(await fetch2(found[1].trim), {
|
|
2351
|
+
content = content.replace(found[0], await renderTemplate(await fetch2(found[1].trim()), {
|
|
2352
2352
|
...data,
|
|
2353
2353
|
[found[2].trim()]: found[3]
|
|
2354
2354
|
}, fetch2));
|