Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1b05af09fb |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ztimson/utils",
|
||||
"version": "0.27.18",
|
||||
"version": "0.27.19",
|
||||
"description": "Utility library",
|
||||
"author": "Zak Timson",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -24,7 +24,7 @@ export async function renderTemplate(template: string, data: any, fetch?: (file:
|
||||
|
||||
const evaluate = (code: string, data: object, fatal = true) => {
|
||||
try {
|
||||
return Function('data', `Object.assign(this, data); return ${code};`)(data);
|
||||
return Function('data', `with(data) { return ${code}; }`)(data);
|
||||
} catch {
|
||||
if(fatal) throw new TemplateError(`Failed to evaluate: ${code}`);
|
||||
else return false;
|
||||
|
||||
Reference in New Issue
Block a user