diff --git a/lib/micro-template.js b/lib/micro-template.js index b92496f..89dfb00 100644 --- a/lib/micro-template.js +++ b/lib/micro-template.js @@ -6,7 +6,7 @@ const template = function (id, data) { if (arguments.length < 2) throw new Error('template() must be called with (template, data)'); const me = template, isArray = Array.isArray(data), keys = isArray ? data : Object.keys(data || {}), key = `data:${id}:${keys.sort().join(':')}`; if (!me.cache.has(key)) me.cache.set(key, (function () { - let name = id, string = /^[\w\-]+$/.test(id) ? me.get(id): (name = `template-${Math.random().toString(36).slice(2)}`, id); // no warnings + let name = id, string = /^[\w\-]+$/.test(id) ? me.get(id): (name = `template-${id.charCodeAt(0)}`, id); // no warnings let line = 1; const body = ( `try {` +