Skip to content

Commit 97bf4e6

Browse files
committed
expand cache key computation (skip ci)
1 parent b4ac1bc commit 97bf4e6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/index.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
const CACHE = {};
1515

1616
export default function html(statics) {
17-
const key = statics.reduce((key, s) => key + s.length + '$' + s, '');
17+
let key = '';
18+
for (let i=0; i<statics.length; i++) {
19+
key += statics[i].length + '$' + statics[i];
20+
}
21+
1822
const tpl = CACHE[key] || (CACHE[key] = build(statics));
1923
// eslint-disable-next-line prefer-rest-params
2024
return tpl(this, arguments);

0 commit comments

Comments
 (0)