I'm not sure whether this is a useful thing or whether it should be changed, but as an artifact of how it was created, shift will "move the tree along". That is to say that
[ { a: [1, 2] }, { b: [3, 4] } }
shifted will result in
[ { a: [2, 3] }, { b: [4] } ]
As opposed to the more conventional
[ { b: [3, 4] } ]
We can call this a bug if we want - but only because it doesn't do what conventional languages do. We can also just reclassify this as a feature, legitimately, some kind of "esoteric full-depth shift".
But if this was to be the case, then it should at least get christened a new name.
I'm not sure whether this is a useful thing or whether it should be changed, but as an artifact of how it was created, shift will "move the tree along". That is to say that
shifted will result in
As opposed to the more conventional
We can call this a bug if we want - but only because it doesn't do what conventional languages do. We can also just reclassify this as a feature, legitimately, some kind of "esoteric full-depth shift".
But if this was to be the case, then it should at least get christened a new name.
I made a gist of the test code that illustrates this: https://gist.github.com/kristopolous/a48600348341007af943