(original: T, instrumented?: T)
| 29 | * @param instrumented The instrumented version (defaults to original if not provided) |
| 30 | */ |
| 31 | export function markAsInstrumented<T>(original: T, instrumented?: T): void { |
| 32 | try { |
| 33 | if (isWeakMapKey(original)) { |
| 34 | // Store mapping from original to instrumented version |
| 35 | // If instrumented is not provided, store original (for backwards compat) |
| 36 | getInstrumentedMap().set(original, instrumented ?? original); |
| 37 | } |
| 38 | // Also mark the instrumented version itself so we recognize it |
| 39 | if (isWeakMapKey(instrumented) && instrumented !== original) { |
| 40 | getInstrumentedMap().set(instrumented, instrumented); |
| 41 | } |
| 42 | } catch { |
| 43 | // ignore errors here |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Get the instrumented version of an object, if available. |
no test coverage detected