-
Notifications
You must be signed in to change notification settings - Fork 33
Description
I've watched the LexoRank video linked from the README, but I couldn't work out from either the video or the README how to best use the library. When reordering an item, calculating the new rank seems pretty straightforward. But it's not clear to me how to get going with a brand new list.
As far as I can tell, you want to do something like:
const firstItem = LexoRank.middle();
const secondItem = firstItem.genNext();
const thirdItem = secondItem.genNext();
But, that "wastes" half of the available rankings for the extremely unlikely event where the entire list gets reversed. But, the first Item can't be LexoRank.min() either, or you'd never be able to put something before it. I guess it could be something like LexoRank.min().between(LexoRank.middle()) or maybe LexoRank.min().genNext(). Maybe there isn't a right answer for this. But, any guidance the document could provide would be much appreciated.
In my particular case, I append items to a list by default and the user might opt to re-order the list. I expect reorderings to be relatively small and infrequent, so my primary concern would be exhausting the default space by cutting it in half each time a new item is appended.