in netlify/functions/store-ping-data-background/index.ts [21:35]
function getstr(field: IndexedStringPingField, s: string | null): StringIndex {
if (!fieldStringLookup.has(field)) {
fieldStringLookup.set(field, new Map<string | null, number>());
}
const stringLookup = fieldStringLookup.get(field)!;
if (!stringLookup.has(s)) {
stringLookup.set(s, output[field].strings.length);
// We've verified that non-null fields will have only non-null
// values (otherwise the ping is dropped), so we can safely push
// the value if null or not.
output[field].strings.push(s as any);
}
return stringLookup.get(s)!;
}