1loc
1loc copied to clipboard
Compare two arrays regardless of order is simply incorrect
https://github.com/1milligram/1loc/blob/cecbfa239c1d6c9d527518c157b9ea20c4140c9b/snippets/array/compare-two-arrays-regardless-of-order.md?plain=1#L10
The Set object lets you store unique values of any type, whether primitive values or object references.
And an array can have duplicate values.
So it fails simplest of tests: isEqual([1], [1, 1]);
Checking for length would be incorrect too, consider such case: isEqual([1, 1, 2], [1, 2, 2]);
Also concerns from #414.
And lastly one should keep in mind that:
const a = {a: 1};
const b = {...a};
a !== b; // true
Maybe it should be documented on equality function page.