1
0

Updated README, fleshed out types doc a bit more

This commit is contained in:
Geoffrey Roberts
2019-03-06 11:06:50 +11:00
parent fec29af546
commit 5612d18669
2 changed files with 34 additions and 22 deletions

52
index.d.ts vendored
View File

@@ -1,26 +1,34 @@
export interface SearchParserOptions {
offsets?: boolean;
tokenize?: boolean;
keywords?: string[];
ranges?: string[];
alwaysArray?: boolean;
}
// @file
// Type definitions for search-query-parser.
// Project: https://github.com/nepsilon/search-query-parser
// Definitions by: Geoffrey Roberts <g.roberts@blackicemedia.com>
// Definitions: https://github.com/nepsilon/search-query-parser
export interface ISearchParserDictionary {
[key: string]: any;
}
export module SearchQueryParser {
export interface SearchParserOptions {
offsets?: boolean;
tokenize?: boolean;
keywords?: string[];
ranges?: string[];
alwaysArray?: boolean;
}
export interface SearchParserOffset {
keyword: string;
value?: string;
offsetStart: number;
offsetEnd: number;
}
export interface ISearchParserDictionary {
[key: string]: any;
}
export interface SearchParserResult extends ISearchParserDictionary {
text?: string | string[];
offsets?: SearchParserOffset[];
exclude?: ISearchParserDictionary;
}
export interface SearchParserOffset {
keyword: string;
value?: string;
offsetStart: number;
offsetEnd: number;
}
export function parse(string: string, options?: SearchParserOptions): string | SearchParserResult;
export interface SearchParserResult extends ISearchParserDictionary {
text?: string | string[];
offsets?: SearchParserOffset[];
exclude?: ISearchParserDictionary;
}
export function parse(string: string, options?: SearchParserOptions): string | SearchParserResult;
}