Skip to content

Commit c54b793

Browse files
committed
cheap unique cache key by joining static segments using a CSV of static segments as the joiner (crazy, I know)
1 parent 97bf4e6 commit c54b793

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/index.mjs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414
const CACHE = {};
1515

1616
export default function html(statics) {
17-
let key = '';
18-
for (let i=0; i<statics.length; i++) {
19-
key += statics[i].length + '$' + statics[i];
20-
}
17+
const key = statics.join(statics);
2118

2219
const tpl = CACHE[key] || (CACHE[key] = build(statics));
2320
// eslint-disable-next-line prefer-rest-params

0 commit comments

Comments
 (0)