This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
toReversed()
is not reversible on sparse arrays #101
Open
Description
I can (with great regret) live with the fact that toSorted()
eliminates empty slots (although I think symmetry with functionally similar APIs is much more charitable than symmetry by the time they were introduced—cf flatMap
, findLast
). However, the fact that toReversed()
is not reversible bothers me.
[1, , 3].toReversed().toReversed(); // [1, undefined, 3]
[, , , ].toReversed(); // This is a symmetrical array; toReversed should be idempotent!
This makes its explanation unnecessarily harder, compared to just saying "every element is swapped", which automatically covers the empty slot case.
Metadata
Metadata
Assignees
Labels
No labels