(obj: object, name: string | symbol, value: unknown)
| 53 | * @param value The value to which to set the property |
| 54 | */ |
| 55 | export function addNonEnumerableProperty(obj: object, name: string | symbol, value: unknown): void { |
| 56 | try { |
| 57 | Object.defineProperty(obj, name, { |
| 58 | // enumerable: false, // the default, so we can save on bundle size by not explicitly setting it |
| 59 | value, |
| 60 | writable: true, |
| 61 | configurable: true, |
| 62 | }); |
| 63 | } catch { |
| 64 | DEBUG_BUILD && debug.log(`Failed to add non-enumerable property "${String(name)}" to object`, obj); |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Remembers the original function on the wrapped function and |
no test coverage detected