(object)
| 25 | const cache = new WeakSet(); |
| 26 | |
| 27 | function fetchData(object) { |
| 28 | if (cache.has(object)) { |
| 29 | // Data already cached for this object |
| 30 | } else { |
| 31 | // Fetch data and store it in cache with a weak reference to the object |
| 32 | cache.add(object); |
| 33 | // ... fetch and store data |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | /******************** Maps ********************/ |
| 38 | /** |
nothing calls this directly
no outgoing calls
no test coverage detected