In ES2019, Array.prototype.sort was "The sort must be stable".
Nevertheless, as some older browsers do not, relying on this behavior requires validation.
... But, is there a way to feature detect that the sort is stable?
If you try with a particular pattern arrangement, you can conclude that it is "unstable" if the stability actually breaks down.
However, no matter how many times you do, if you get a stable result, you can't tell whether it's a result that's limited to the data you've executed or that it's really guaranteed that the sort is stable.
I would be grateful if there was a way to "check stability" beyond such a barrier.
Aucun commentaire:
Enregistrer un commentaire