DefinitelyTyped/fuse/fuse.d.ts
2016-03-17 21:06:54 +09:00

29 lines
742 B
TypeScript

// Type definitions for Fuse.js 1.1.5
// Project: https://github.com/krisk/Fuse
// Definitions by: Greg Smith <https://github.com/smrq/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class Fuse {
constructor(list: any[], options?: fuse.IFuseOptions);
search(pattern: string): any[];
}
declare namespace fuse {
interface IFuseOptions extends ISearchOptions {
caseSensitive?: boolean;
includeScore?: boolean;
shouldSort?: boolean;
searchFn?: any;
sortFn?: (a: {score: number}, b: {score: number}) => number;
getFn?: (obj: any, path: string) => any;
keys?: string[];
}
interface ISearchOptions {
location?: number;
distance?: number;
threshold?: number;
maxPatternLength?: number;
}
}