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 | 14x 14x 14x 14x | import { ReflectSetPrototypeOf } from './Reflect'; import { SymbolToStringTag } from './Symbol'; export const WeakSetCtor = WeakSet; const { prototype: WeakSetProto } = WeakSetCtor; export const { has: WeakSetProtoHas } = WeakSetProto; const { add: WeakSetProtoAdd, delete: WeakSetProtoDelete, [SymbolToStringTag]: WeakSetProtoSymbolToStringTag, } = WeakSetProto as any; export function toSafeWeakSet<T extends WeakSet<any>>(weakSet: T): T { ReflectSetPrototypeOf(weakSet, null); weakSet.add = WeakSetProtoAdd; weakSet.delete = WeakSetProtoDelete; weakSet.has = WeakSetProtoHas; (weakSet as any)[SymbolToStringTag] = WeakSetProtoSymbolToStringTag; ReflectSetPrototypeOf(weakSet, WeakSetProto); return weakSet; } |