lib: add SafeSet.prototype.toUnsafeSet#57723
Conversation
This should help with nodejs#57688 and others
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #57723 +/- ##
=======================================
Coverage 90.22% 90.23%
=======================================
Files 630 630
Lines 185073 185079 +6
Branches 36222 36222
=======================================
+ Hits 166990 166998 +8
+ Misses 11044 11040 -4
- Partials 7039 7041 +2
🚀 New features to boost your workflow:
|
| const set = new Set(); | ||
| this.forEach((value) => primordials.SetPrototypeAdd(set, value)); | ||
| return set; |
There was a problem hiding this comment.
Can we write tests that validates no user-code would be run? I think this can be simplified to
| const set = new Set(); | |
| this.forEach((value) => primordials.SetPrototypeAdd(set, value)); | |
| return set; | |
| return new Set(this); |
(given the triviality of the implementation, I wonder if it actually makes sense to add a method for that)
There was a problem hiding this comment.
Sure! I couldn't find anywhere SafeSet is already tested, so i'm not sure where to add them - any suggestions?
I guess this is a valid simplification since it has a safe [Symbol.iterator] on it, in which case you're right, it's probably not needed. I was assuming add-at-construction-time wasn't an option.
|
Closing, given #57723 (comment) |
This should help with #57688 and others.