Skip to content
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

in node 0.10, Map.prototype.forEach.call({}, function () {}) does not throw #144

Closed
ljharb opened this issue Dec 15, 2015 · 8 comments
Closed
Labels

Comments

@ljharb
Copy link

ljharb commented Dec 15, 2015

Map#forEach and Set#forEach are supposed to throw a TypeError if their receiver/"this" value is not an actual Map or Set. In node 0.12 and later, with core-js required, it throws as expected, but in node 0.10 and earlier, it does not.

This is preventing is-equal and expect from working with core-js in an environment without native Map and Set, since it gives false positives for object values.

@zloirock
Copy link
Owner

I saw this issue. I don't think it is a principal behavior for polyfill, but ok, I will add it.

@ljharb
Copy link
Author

ljharb commented Dec 15, 2015

It's the only reliable way to determine if something is a Map or Set, cross-realm (ie, not relying on instanceof). Thanks!

@mjackson
Copy link

👍 Thanks, @zloirock! This is important for feature detection.

ljharb added a commit to inspect-js/is-equal that referenced this issue Dec 16, 2015
Also add `npm run test:corejs`.

Relates to #4.
@zloirock zloirock added the es6 label Dec 17, 2015
@ljharb
Copy link
Author

ljharb commented Dec 17, 2015

Thanks! Please let me know when you release a v2.0.0

@ljharb
Copy link
Author

ljharb commented Dec 21, 2015

Any update? I'd love to verify that is-equal works with core-js v2 and higher.

@zloirock
Copy link
Owner

Any update?

Available 2.0.0-beta.2, I should stabilize a few more things before the final release.

@ljharb
Copy link
Author

ljharb commented Dec 21, 2015

Great, thanks!

@zloirock
Copy link
Owner

Available in 2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants