-
Notifications
You must be signed in to change notification settings - Fork 117
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
Set equality is unexpectedly ordered #93
Comments
Your expectation is incorrect - |
I wouldn't expect the preserved insertion order of the set — which is noted in the spec — to influence its equality properties, but hey, JS is full of surprises. Time to switch to |
I think it'd be reasonable to have a method that explicitly checked that two Sets/Maps/arrays had the same contents, irrespective of order. |
@ljharb What would you call the |
hmm - naming is hard :-) something like |
How about |
Actually, just found this:
Seems like we should just do some type detection in |
@mjackson if it's generic, that would break tests that currently compare array orderings. If it's not - and only for |
Even though they are implicitly ordered, conceptually a Set is not. toEqual is the right method IMO. |
I don't agree in the case of JS - but it wouldn't be a tragedy imo to have |
I'd be open to a PR that does this, @rnewman, if you're up for it. :) |
This is with 1.18.0. I expect set equality to be independent of order; the order of elements is an implementation detail.
The text was updated successfully, but these errors were encountered: