fast-equals icon indicating copy to clipboard operation
fast-equals copied to clipboard

Handling unordered equality for primitive arrays

Open SaumyaK-Temerity opened this issue 8 months ago • 1 comments

Is it possible to add logic in order to handle primitive arrays such that the order is irrelevant? Because from my point of view, I would think that: ['4', '3'] is equal to ['3', '4'], but it's not.

So for equality, shouldn't these two be considered the same. Especially for things like "deep" equality?

I'm not too sure how deep the rabbit hole goes for trying to handle this for generic arrays, I imagine there's a lot more underlying complexity than what I understand...but just for arrays with only primitive elements...how difficult would this be to implement?

Or if it's possible to pass in an "unordered=true" type of optional argument that ignores the order for arrays?

SaumyaK-Temerity avatar Oct 20 '23 13:10 SaumyaK-Temerity