| 1 |
export as namespace fuzzaldrin; |
| 2 |
|
| 3 |
export class Query { |
| 4 |
$$__internal: Symbol; |
| 5 |
} |
| 6 |
|
| 7 |
export interface IOptions { |
| 8 |
allowErrors?: boolean | undefined; |
| 9 |
usePathScoring?: boolean | undefined; |
| 10 |
useExtensionBonus?: boolean | undefined; |
| 11 |
pathSeparator?: "/" | "\\" | string | undefined; |
| 12 |
optCharRegEx?: RegExp | undefined; |
| 13 |
wrap?: { tagOpen?: string | undefined; tagClass?: string | undefined; tagClose?: string | undefined } | undefined; |
| 14 |
preparedQuery?: Query | undefined; |
| 15 |
} |
| 16 |
|
| 17 |
export type IFilterOptions<T> = IOptions & { |
| 18 |
key?: T extends string ? never : keyof T | undefined; |
| 19 |
maxResults?: number | undefined; |
| 20 |
maxInners?: number | undefined; |
| 21 |
}; |
| 22 |
|
| 23 |
export function filter<T>( |
| 24 |
data: T[], |
| 25 |
query: string, |
| 26 |
options?: IFilterOptions<T>, |
| 27 |
): T[]; |
| 28 |
export function score(str: string, query: string, options?: IOptions): number; |
| 29 |
export function match(str: string, query: string, options?: IOptions): number[]; |
| 30 |
export function wrap(str: string, query: string, options?: IOptions): string; |
| 31 |
export function prepareQuery(query: string, options?: IOptions): Query; |