Skip to content

Commit fe02c30

Browse files
committed
lib: add SafeSet.prototype.toUnsafeSet
This should help with nodejs#57688 and others
1 parent 3db5491 commit fe02c30

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/internal/per_context/primordials.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,12 @@ primordials.SafeSet = makeSafe(
420420
Set,
421421
class SafeSet extends Set {
422422
constructor(i) { super(i); } // eslint-disable-line no-useless-constructor
423+
424+
toUnsafeSet() {
425+
const set = new Set();
426+
this.forEach((value) => primordials.SetPrototypeAdd(set, value));
427+
return set;
428+
}
423429
},
424430
);
425431
primordials.SafeWeakSet = makeSafe(

0 commit comments

Comments
 (0)