rocicorp / fractional-indexing

Fractional Indexing in JavaScript
https://npmjs.com/fractional-indexing
Creative Commons Zero v1.0 Universal
316 stars 23 forks source link

fix: make it work with arbitrary base digits #15

Closed Azarattum closed 1 year ago

Azarattum commented 1 year ago

This patch fixes the library to work with bases other than 62. The main problem was that the character 0 had a special meaning as the first (lowest) character, which is not true for every base. For example, in base 95 (which you can get with this snippet) the ` (space) is the lowest character. Therefore, we should infer the 'zero' from thedigits` parameter.

This PR also contains additional tests for the base 95 case.

arv commented 1 year ago

Very nice. I'll take a closer look on Monday

arv commented 1 year ago

LGTM

I'll make another minor release with this