Open miyanokomiya opened 1 day ago
Hello, thanks for the great tool.
I came across unexpected behavior of generateJitteredKeyBetween. I'd appreciate if there's any idea or help for it.
generateJitteredKeyBetween
This works and returns b0U.
b0U
generateJitteredKeyBetween("b0T46n", null);
But, this doesn't work.
generateJitteredKeyBetween(null, "b0T46n");
Error logs.
Error: invalid order key length: bS ❯ getIntegerPart node_modules/fractional-indexing-jittered/lib/index.js:256:11 254| const integerPartLength = integerLength(head, charSet); 255| if (integerPartLength > orderKey.length) { 256| throw new Error("invalid order key length: " + orderKey); | ^ 257| } 258| return orderKey.slice(0, integerPartLength); ❯ paddingNeededForJitter node_modules/fractional-indexing-jittered/lib/index.js:353:19 ❯ Module.generateJitteredKeyBetween node_modules/fractional-indexing-jittered/lib/index.js:417:25 ❯ src/utils/findex.spec.ts:47:27
The function without jittered works and returns bS.
bS
console.log(generateKeyBetween(null, "b0T46n"));
Thanks!
It seems tweaking this part would solve this case though, not sure how it affects other parts.
while (result.length > 2 && result[0] === charSet.byCode[0]) {
https://github.com/TMeerhof/fractional-indexing-jittered/blob/8077c3090ab497c39d89f7b478b7abcc1fd897c0/src/keyAsNumber.ts#L109
Hello, thanks for the great tool.
I came across unexpected behavior of
generateJitteredKeyBetween
. I'd appreciate if there's any idea or help for it.This works and returns
b0U
.But, this doesn't work.
Error logs.
The function without jittered works and returns
bS
.Thanks!