UNPKG

@picosearch/radix-tree

Version:

Simple, zero dependency, type-safe implementation of a radix tree data structure.

15 lines (14 loc) 628 B
import type { RadixTreeMapNode } from './types'; /** * Insert a value into a sorted array efficiently. * * Reference: https://stackoverflow.com/a/21822316 * * @param array - The array to insert into. Must be sorted. * @param value - The value to insert. * @param compare - The comparison function. */ export declare const sortedInsert: <T>(array: T[], value: T, compare: (a: T, b: T) => number) => void; export declare const getNewEmptyNode: <T>() => RadixTreeMapNode<T>; export declare const getCommonPrefix: (a: string, b: string) => string; export declare const assert: (condition: boolean, message: string) => void;