0.5.4
The CLI and the underlying Tree.plain function have been adjusted to produce more useful results when manipulating an array. Follow that link for more details.
Previously, applying Tree.reverse or Tree.sort to an array in the CLI would return a plain JS object. Because JavaScript always sorts the numeric keys of an object, this would have the effect of undoing the work of Tree.reverse or Tree.sort. Those functions only change the order of keys, they don't change a key's numeric value. So previously you would see
$ ori Tree.reverse [5, 2, 8]
- 5
- 2
- 8which makes it look like Tree.reverse had no effect.
Tree.plain now expands its definition of an "array-like" tree to any tree whose keys are integers completely covering the range 0..length-1. Given an array-like tree, Tree.plain will return a JavaScript array with the tree's values in the order they're given but ignoring the numeric value of the keys.
$ ori Tree.reverse [5, 2, 8]
- 8
- 2
- 5