seaq
Version:
ES6 Text Search.
16 lines (15 loc) • 966 B
TypeScript
/**
* Given an input list Array<T>, a set of object keys to search, and a search
* query, Seaq will return a new Array<T> containing the results ordered by
* their Score which is calculated using a variation of string_score algorithm.
*
* @export
* @template T generic
* @param {Array<T>} list list of objects or strings to search
* @param {string} query query string to match against keys in objects
* @param {(Array<Extract<keyof T, string>> | string[])} keys optional keys to search in the object
* @param {number} [fuzzy] optional fuzziness should be between 0 and 1. low fuzziness like 0.01 means a mismatch will drop the score more then a fuzziness of something like 0.9.
* @returns {Array<T>}
*/
export declare function seaq<T>(list: Array<T>, query: string, keys?: Array<Extract<keyof T, string>> | string[], fuzzy?: number): Array<T>;
export declare function getProperty(obj: any, path: string | null, list?: string[]): string[];