File size: 333 Bytes
fc93158
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
export function resolveProcessScopedMap<T>(key: symbol): Map<string, T> {
  const proc = process as NodeJS.Process & {
    [symbolKey: symbol]: Map<string, T> | undefined;
  };
  const existing = proc[key];
  if (existing) {
    return existing;
  }
  const created = new Map<string, T>();
  proc[key] = created;
  return created;
}