1.0.5 • Published 4 years ago
@inquisitive/between v1.0.5
@inquisitive/between
This repo is simply a rewritten and an improvement of between in typescript. At Inquisitive we have been using between for many years, with @ts-ignore, which doesn't look good in a full type safe codebase. So we rewrote it in typescript, and using localCompare instead of the greater than > string comparsion. Have a read at this post for the differences.
How it works?
There is a sequence of items with sorting in place
A (sortValue: 'a')
B (sortValue: 'b')Now we want to add a new item C to the list in between A and B, without updating the sortValue of A and B so the list becomes
A (sortValue: 'a')
C (sortValue: ?)
B (sortValue: 'b')Using between('a','b') will return the string that sorts between a and b, which in this case is aV.