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

comparing a fake Map, Set, etc throws #99

Closed
ljharb opened this issue May 30, 2024 · 5 comments · Fixed by #100 or #101
Closed

comparing a fake Map, Set, etc throws #99

ljharb opened this issue May 30, 2024 · 5 comments · Fixed by #100 or #101

Comments

@ljharb
Copy link
Contributor

ljharb commented May 30, 2024

It seems like comparing anything that's a builtin that should have internal slots, that is only pretending to be that builtin, throws instead of returning false.

var maplikeSet = new Set();
Object.defineProperty(maplikeSet, 'constructor', { enumerable: false, value: Map });

deepEqual(maplikeSet, new Map());

this should return false, but instead, it throws:

TypeError: Method get Map.prototype.size called on incompatible receiver #<Map>

This bug is affecting v4 as well, so once fixed in v5, a backport would be appreciated.

I'd be happy to make a PR for both, if desired.

@keithamus
Copy link
Member

Thanks for discovering and filing this issue. A PR would be great to see, thanks!

ljharb added a commit to ljharb/deep-eql that referenced this issue May 31, 2024
@ljharb
Copy link
Contributor Author

ljharb commented May 31, 2024

#100

keithamus pushed a commit that referenced this issue Jun 3, 2024
@ljharb
Copy link
Contributor Author

ljharb commented Jun 3, 2024

Thanks! I’d love to make a PR to v4, but i think there’d need to be a v4 branch created first. Are you willing to make a branch and publish a backport if I make the PR?

@keithamus
Copy link
Member

Sure. v4 branch has been created and is ready for a PR

@ljharb
Copy link
Contributor Author

ljharb commented Jun 4, 2024

Thanks! → #101

keithamus pushed a commit that referenced this issue Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants