Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 14x 14x 14x 14x 11x 11x 11x 11x 11x 11x 11x 11x | import { ReflectSetPrototypeOf } from './Reflect'; import { SymbolToStringTag } from './Symbol'; export const WeakMapCtor = WeakMap; const { prototype: WeakMapProto } = WeakMapCtor; export const { has: WeakMapProtoHas } = WeakMapProto; const { delete: WeakMapProtoDelete, get: WeakMapProtoGet, set: WeakMapProtoSet, [SymbolToStringTag]: WeakMapProtoSymbolToStringTag, } = WeakMapProto as any; export function toSafeWeakMap<T extends WeakMap<any, any>>(weakMap: T): T { ReflectSetPrototypeOf(weakMap, null); weakMap.delete = WeakMapProtoDelete; weakMap.get = WeakMapProtoGet; weakMap.has = WeakMapProtoHas; weakMap.set = WeakMapProtoSet; (weakMap as any)[SymbolToStringTag] = WeakMapProtoSymbolToStringTag; ReflectSetPrototypeOf(weakMap, WeakMapProto); return weakMap; } |