-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Can we try object.toString before Object.prototype.toString? #78
Comments
To be clear, my proposal is: https://github.com/inspect-js/is-equal/blob/main/why.js#L46-L50 If It seems like this would solve problems for any objects that define their own |
That’s not a bad comparison to add; we could check valueOf and Symbol.toPrimitive as well, and use es-to-primitive with different hints to cover them all. That way we don’t have to check specific methods, we can just compare “coercing to a string” and “coercing to a number”, altho we’d have to try/catch to account for things that throw (like symbols), in which case “both throw” would be considered equal. |
@ljharb submitted two PRs, one with the fix, and another for the version bump. Used es-to-primitive with separate hints, as you requested. Lmk if you have feedback. |
Thanks, I’ll take a look - versions are never bumped in PRs, though, nor by non-maintainers, anywhere on github. |
Thanks for merging! Sorry to keep bugging you – do you have an ETA on 1.6.5? Eager to get this updated in our project. |
It’d be 1.7.0, and not just yet, but hopefully soon. Fixed by #79. |
Running into the following issue when comparing MongoDB ObjectIds:
npm versions:
expect uses
is-equal: ^1.5.1
, so pushing 1.6.5 would resolve this issue. Happy to submit a PR! Just want to know if it'd be approved.The text was updated successfully, but these errors were encountered: