You've already forked search-query-parser
Updated README, fleshed out types doc a bit more
This commit is contained in:
@@ -114,6 +114,10 @@ var parsedQueryWithOptions = searchQuery.parse(query, options);
|
|||||||
|
|
||||||
The offsets object could become pretty huge with long search queries which could be an unnecessary use of space if no functionality depends on it. It can simply be turned off using the option `offsets: false`
|
The offsets object could become pretty huge with long search queries which could be an unnecessary use of space if no functionality depends on it. It can simply be turned off using the option `offsets: false`
|
||||||
|
|
||||||
|
## Typescript
|
||||||
|
|
||||||
|
Typescript types are available for this library.
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
The 29 tests are written using the BDD testing framework should.js, and run with mocha.
|
The 29 tests are written using the BDD testing framework should.js, and run with mocha.
|
||||||
|
|||||||
52
index.d.ts
vendored
52
index.d.ts
vendored
@@ -1,26 +1,34 @@
|
|||||||
export interface SearchParserOptions {
|
// @file
|
||||||
offsets?: boolean;
|
// Type definitions for search-query-parser.
|
||||||
tokenize?: boolean;
|
// Project: https://github.com/nepsilon/search-query-parser
|
||||||
keywords?: string[];
|
// Definitions by: Geoffrey Roberts <g.roberts@blackicemedia.com>
|
||||||
ranges?: string[];
|
// Definitions: https://github.com/nepsilon/search-query-parser
|
||||||
alwaysArray?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ISearchParserDictionary {
|
export module SearchQueryParser {
|
||||||
[key: string]: any;
|
export interface SearchParserOptions {
|
||||||
}
|
offsets?: boolean;
|
||||||
|
tokenize?: boolean;
|
||||||
|
keywords?: string[];
|
||||||
|
ranges?: string[];
|
||||||
|
alwaysArray?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export interface SearchParserOffset {
|
export interface ISearchParserDictionary {
|
||||||
keyword: string;
|
[key: string]: any;
|
||||||
value?: string;
|
}
|
||||||
offsetStart: number;
|
|
||||||
offsetEnd: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SearchParserResult extends ISearchParserDictionary {
|
export interface SearchParserOffset {
|
||||||
text?: string | string[];
|
keyword: string;
|
||||||
offsets?: SearchParserOffset[];
|
value?: string;
|
||||||
exclude?: ISearchParserDictionary;
|
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;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user