-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathindex.d.ts
50 lines (41 loc) · 1.34 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// @file
// Type definitions for search-query-parser.
// Project: https://github.com/nepsilon/search-query-parser
// Definitions by: Geoffrey Roberts <[email protected]>
// Definitions: https://github.com/nepsilon/search-query-parser
export interface SearchParserOptions {
offsets?: boolean;
tokenize?: boolean;
keywords?: string[];
ranges?: string[];
alwaysArray?: boolean;
}
export interface ISearchParserDictionary {
[key: string]: any;
}
export type SearchParserOffset = (SearchParserKeyWordOffset | SearchParserTextOffset) & {
offsetStart: number;
offsetEnd: number;
}
export type SearchParserKeyWordOffset = {
keyword: string;
value?: string;
}
export type SearchParserTextOffset = {
text: string;
}
export interface SearchParserResult extends ISearchParserDictionary {
text?: string | string[];
offsets?: SearchParserOffset[];
exclude?: ISearchParserDictionary;
}
export function parse(string: string, options?: SearchParserOptions & {
tokenize: false
}): string;
export function parse(string: string, options?: SearchParserOptions & {
tokenize: true
}): SearchParserResult & {
text?: string[]
};
export function parse(string: string, options?: SearchParserOptions): string | SearchParserResult;
export function stringify(searchParserResult: string | SearchParserResult, options?: SearchParserOptions): string;