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

Add option to allow comparing of primitive and boxed values #2

Closed
curiousdannii opened this issue Oct 30, 2015 · 4 comments
Closed

Comments

@curiousdannii
Copy link

Would it be possible to add an option which would compare primitives and boxed values of the same type with ==? I would not want any type conversions, only for these tests to be swapped when the option is enabled.

@btd
Copy link
Member

btd commented Oct 30, 2015

So you just want primitive to be equal to its wrapper?

@btd
Copy link
Member

btd commented Oct 30, 2015

Because with == it will be possible to get more side effects with falsy values etc (not only coerced by .valueOf)

@curiousdannii
Copy link
Author

Yeah, I'd like for should.js to ignore when strings have been boxed when testing with eql(), including strings within deep comparisons. I personally don't anticipate comparison numbers or booleans as well, but for consistency it would make sense for the option to apply to them as well. So I guess it would be better to check A.valueOf() === B.valueOf().

@curiousdannii
Copy link
Author

I changed what I was doing and no longer need this. It could still be a useful option for others, but I'll close the issue now.

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

No branches or pull requests

2 participants