-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why does set.prototype.difference
need to test regex?
#2
Comments
That’s just an implementation detail (it’s detecting binary/octal/hex prefixes in StringToNumber), but the frozen intrinsics flag isn’t default precisely because it breaks things. I’ll leave this open for now, but it probably will be closed in favor of inspect-js/is-regex#34 |
🤔 But why need What are the logical differences compared with https://stackoverflow.com/questions/1723168/what-is-the-fastest-or-most-elegant-way-to-compute-a-set-difference-using-javasc/36504668#36504668 console.clear();
let a = new Set([1, 2, 3, 4]);
let b = new Set([5, 4, 3, 2]);
let a_minus_b = new Set([...a].filter(x => !b.has(x)));
let b_minus_a = new Set([...b].filter(x => !a.has(x)));
let a_intersect_b = new Set([...a].filter(x => b.has(x)));
let a_union_b = new Set([...a, ...b]);
console.log(...a_minus_b); // {1}
console.log(...b_minus_a); // {5}
console.log(...a_intersect_b); // {2,3,4}
console.log(...a_union_b); // {1,2,3,4,5} |
Oh, I’m this case it’s not actually invoked by this package, it’s just something that’s evaluated as part of loading the module. That’s what the flag is affecting - you should be able to repro it with nothing except a require of the package. |
(it would be needed if a setlike provided a string size, fwiw) |
I'm going to close this in favor of ljharb/call-bind#4, which is where it would be handled, if at all. In the meantime, I strongly suggest not using the frozen-intrinsics flag. |
Reproduce
Expected
Unexpected
Related
inspect-js/is-regex#34
The text was updated successfully, but these errors were encountered: