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