interpolate-es
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -1,1 +0,1 @@ | ||
export default function(r,o={}){const e=Object.keys(o),n=Object.values(o);try{return new Function(...e,`return \`${r}\`;`)(...n)}catch(e){throw console.group("Template Error:"),console.error(o),console.error(r),console.groupEnd(),Error(e)}} | ||
class e extends Error{constructor(e,t,n){super(),this.name="TemplateError";let r="\n------------------\n";r+=`Template: \`${e}\``,r+="\n------------------\n",r+=`Tags: ${JSON.stringify(t,null,2)}`,r+="\n------------------\n",r+=n,this.message=r}}export default function(t,n={}){const r=Object.keys(n),s=Object.values(n);try{return new Function(...r,`return \`${t}\`;`)(...s)}catch(r){throw new e(t,n,r)}} |
{ | ||
"name": "interpolate-es", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Dynamically build tagged templates", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -15,8 +15,18 @@ /* eslint-disable no-new-func */ | ||
} catch (e) { | ||
console.group('Template Error:'); | ||
console.error(tags); | ||
console.error(template); | ||
console.groupEnd(); | ||
throw Error(e); | ||
throw new TemplateException(template, tags, e); | ||
} | ||
} | ||
class TemplateException extends Error { | ||
constructor (template, tags, message) { | ||
super(); | ||
this.name = 'TemplateError'; | ||
let msg = '\n------------------\n'; | ||
msg += `Template: \`${template}\``; | ||
msg += '\n------------------\n'; | ||
msg += `Tags: ${JSON.stringify(tags, null, 2)}`; | ||
msg += '\n------------------\n'; | ||
msg += message; | ||
this.message = msg; | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6848
74