### Generate Multiple Keys Fractional Index TS Source: https://github.com/rocicorp/fractional-indexing/blob/main/README.md This function generates a specified number (`n`) of fractional index keys evenly spaced between two existing keys (`a` and `b`). It helps maintain shorter keys when inserting multiple items at once. An optional custom character set can be provided. ```ts generateNKeysBetween( a: string | null | undefined, // start b: string | null | undefined, // end n: number // number of keys to generate evenly between start and end digits?: string | undefined = BASE_62_DIGITS // optional character encoding ): string[]; ``` ```ts import { generateNKeysBetween } from 'fractional-indexing'; const first = generateNKeysBetween(null, null, 2); // ['a0', 'a1'] // Insert two keys after 2nd generateNKeysBetween(first[1], null, 2); // ['a2', 'a3'] // Insert two keys before 1st generateNKeysBetween(null, first[0], 2); // ['Zy', 'Zz'] // Insert two keys in between 1st and 2nd (midpoints) generateNKeysBetween(second, third, 2); // ['a0G', 'a0V'] ``` -------------------------------- ### Generate Single Key Fractional Index TS Source: https://github.com/rocicorp/fractional-indexing/blob/main/README.md This function generates a single fractional index key located between two existing keys (`a` and `b`). It supports optional custom character sets for the keys. The function is useful for inserting a single item into an ordered sequence. ```ts generateKeyBetween( a: string | null | undefined, // start b: string | null | undefined, // end digits?: string | undefined = BASE_62_DIGITS // optional character encoding ): string; ``` ```ts import { generateKeyBetween } from 'fractional-indexing'; const first = generateKeyBetween(null, null); // "a0" // Insert after 1st const second = generateKeyBetween(first, null); // "a1" // Insert after 2nd const third = generateKeyBetween(second, null); // "a2" // Insert before 1st const zeroth = generateKeyBetween(null, first); // "Zz" // Insert in between 2nd and 3rd (midpoint) const secondAndHalf = generateKeyBetween(second, third); // "a1V" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.