(path: unknown[], factory: () => V)
| 92 | } |
| 93 | |
| 94 | function getOrCreate(path: unknown[], factory: () => V) { |
| 95 | const targetMap = getFinalTargetMap(path); |
| 96 | |
| 97 | if (targetMap.has(targetSymbol)) { |
| 98 | return targetMap.get(targetSymbol) as V; |
| 99 | } |
| 100 | |
| 101 | const newResult = factory(); |
| 102 | |
| 103 | targetMap.set(targetSymbol, newResult); |
| 104 | |
| 105 | return newResult; |
| 106 | } |
| 107 | |
| 108 | return { getOrCreate, has, set, get }; |
| 109 | } |
nothing calls this directly
no test coverage detected