1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
'use strict'; /** * @param {string} value * @param {(value: string, num: number) => string} encoder * @param {Record<string, {ident: string, count: number}>} cache * @return {void} */ module.exports = function (value, encoder, cache) { if (cache[value]) { return; } cache[value] = { ident: encoder(value, Object.keys(cache).length), count: 0, }; };