123456789101112131415161718192021222324252627282930313233343536 |
- "use strict";
- exports.getOrInsert = (map, key, computer) => {
-
- const value = map.get(key);
-
- if (value !== undefined) return value;
-
- const newValue = computer();
- map.set(key, newValue);
- return newValue;
- };
|