choices.js
Version:
A vanilla JS customisable text input/select box plugin
13 lines (11 loc) • 348 B
text/typescript
export interface SearchResult<T extends object> {
item: T;
score: number;
rank: number; // values of 0 means this item is not in the search-result set, and should be discarded
}
export interface Searcher<T extends object> {
reset(): void;
isEmptyIndex(): boolean;
index(data: T[]): void;
search(needle: string): SearchResult<T>[];
}