You've already forked search-query-parser
Added type documentation
This commit is contained in:
@@ -116,7 +116,10 @@ The offsets object could become pretty huge with long search queries which could
|
|||||||
|
|
||||||
## Typescript
|
## Typescript
|
||||||
|
|
||||||
Typescript types are available for this library.
|
Typescript types are available for this library in the `docs` directory.
|
||||||
|
[Browse type documentation here.](docs/README.md)
|
||||||
|
|
||||||
|
Documentation is generated using `node_modules/.bin/typedoc index.d.ts`
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
|
|||||||
11
docs/README.md
Normal file
11
docs/README.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
# search-query-parser
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
### External modules
|
||||||
|
|
||||||
|
* ["index.d"](modules/_index_d_.md)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
[search-query-parser](../README.md) > ["index.d"](../modules/_index_d_.md) > [SearchQueryParser](../modules/_index_d_.searchqueryparser.md) > [ISearchParserDictionary](../interfaces/_index_d_.searchqueryparser.isearchparserdictionary.md)
|
||||||
|
|
||||||
|
# Interface: ISearchParserDictionary
|
||||||
|
|
||||||
|
## Hierarchy
|
||||||
|
|
||||||
|
**ISearchParserDictionary**
|
||||||
|
|
||||||
|
↳ [SearchParserResult](_index_d_.searchqueryparser.searchparserresult.md)
|
||||||
|
|
||||||
|
## Indexable
|
||||||
|
|
||||||
|
\[key: `string`\]: `any`
|
||||||
|
## Index
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
[search-query-parser](../README.md) > ["index.d"](../modules/_index_d_.md) > [SearchQueryParser](../modules/_index_d_.searchqueryparser.md) > [SearchParserOffset](../interfaces/_index_d_.searchqueryparser.searchparseroffset.md)
|
||||||
|
|
||||||
|
# Interface: SearchParserOffset
|
||||||
|
|
||||||
|
## Hierarchy
|
||||||
|
|
||||||
|
**SearchParserOffset**
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
### Properties
|
||||||
|
|
||||||
|
* [keyword](_index_d_.searchqueryparser.searchparseroffset.md#keyword)
|
||||||
|
* [offsetEnd](_index_d_.searchqueryparser.searchparseroffset.md#offsetend)
|
||||||
|
* [offsetStart](_index_d_.searchqueryparser.searchparseroffset.md#offsetstart)
|
||||||
|
* [value](_index_d_.searchqueryparser.searchparseroffset.md#value)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
<a id="keyword"></a>
|
||||||
|
|
||||||
|
### keyword
|
||||||
|
|
||||||
|
**● keyword**: *`string`*
|
||||||
|
|
||||||
|
*Defined in [index.d.ts:21](https://github.com/rtrvrtg/search-query-parser/blob/5612d18/index.d.ts#L21)*
|
||||||
|
|
||||||
|
___
|
||||||
|
<a id="offsetend"></a>
|
||||||
|
|
||||||
|
### offsetEnd
|
||||||
|
|
||||||
|
**● offsetEnd**: *`number`*
|
||||||
|
|
||||||
|
*Defined in [index.d.ts:24](https://github.com/rtrvrtg/search-query-parser/blob/5612d18/index.d.ts#L24)*
|
||||||
|
|
||||||
|
___
|
||||||
|
<a id="offsetstart"></a>
|
||||||
|
|
||||||
|
### offsetStart
|
||||||
|
|
||||||
|
**● offsetStart**: *`number`*
|
||||||
|
|
||||||
|
*Defined in [index.d.ts:23](https://github.com/rtrvrtg/search-query-parser/blob/5612d18/index.d.ts#L23)*
|
||||||
|
|
||||||
|
___
|
||||||
|
<a id="value"></a>
|
||||||
|
|
||||||
|
### `<Optional>` value
|
||||||
|
|
||||||
|
**● value**: *`string`*
|
||||||
|
|
||||||
|
*Defined in [index.d.ts:22](https://github.com/rtrvrtg/search-query-parser/blob/5612d18/index.d.ts#L22)*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
[search-query-parser](../README.md) > ["index.d"](../modules/_index_d_.md) > [SearchQueryParser](../modules/_index_d_.searchqueryparser.md) > [SearchParserOptions](../interfaces/_index_d_.searchqueryparser.searchparseroptions.md)
|
||||||
|
|
||||||
|
# Interface: SearchParserOptions
|
||||||
|
|
||||||
|
## Hierarchy
|
||||||
|
|
||||||
|
**SearchParserOptions**
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
### Properties
|
||||||
|
|
||||||
|
* [alwaysArray](_index_d_.searchqueryparser.searchparseroptions.md#alwaysarray)
|
||||||
|
* [keywords](_index_d_.searchqueryparser.searchparseroptions.md#keywords)
|
||||||
|
* [offsets](_index_d_.searchqueryparser.searchparseroptions.md#offsets)
|
||||||
|
* [ranges](_index_d_.searchqueryparser.searchparseroptions.md#ranges)
|
||||||
|
* [tokenize](_index_d_.searchqueryparser.searchparseroptions.md#tokenize)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
<a id="alwaysarray"></a>
|
||||||
|
|
||||||
|
### `<Optional>` alwaysArray
|
||||||
|
|
||||||
|
**● alwaysArray**: *`boolean`*
|
||||||
|
|
||||||
|
*Defined in [index.d.ts:13](https://github.com/rtrvrtg/search-query-parser/blob/5612d18/index.d.ts#L13)*
|
||||||
|
|
||||||
|
___
|
||||||
|
<a id="keywords"></a>
|
||||||
|
|
||||||
|
### `<Optional>` keywords
|
||||||
|
|
||||||
|
**● keywords**: *`string`[]*
|
||||||
|
|
||||||
|
*Defined in [index.d.ts:11](https://github.com/rtrvrtg/search-query-parser/blob/5612d18/index.d.ts#L11)*
|
||||||
|
|
||||||
|
___
|
||||||
|
<a id="offsets"></a>
|
||||||
|
|
||||||
|
### `<Optional>` offsets
|
||||||
|
|
||||||
|
**● offsets**: *`boolean`*
|
||||||
|
|
||||||
|
*Defined in [index.d.ts:9](https://github.com/rtrvrtg/search-query-parser/blob/5612d18/index.d.ts#L9)*
|
||||||
|
|
||||||
|
___
|
||||||
|
<a id="ranges"></a>
|
||||||
|
|
||||||
|
### `<Optional>` ranges
|
||||||
|
|
||||||
|
**● ranges**: *`string`[]*
|
||||||
|
|
||||||
|
*Defined in [index.d.ts:12](https://github.com/rtrvrtg/search-query-parser/blob/5612d18/index.d.ts#L12)*
|
||||||
|
|
||||||
|
___
|
||||||
|
<a id="tokenize"></a>
|
||||||
|
|
||||||
|
### `<Optional>` tokenize
|
||||||
|
|
||||||
|
**● tokenize**: *`boolean`*
|
||||||
|
|
||||||
|
*Defined in [index.d.ts:10](https://github.com/rtrvrtg/search-query-parser/blob/5612d18/index.d.ts#L10)*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
[search-query-parser](../README.md) > ["index.d"](../modules/_index_d_.md) > [SearchQueryParser](../modules/_index_d_.searchqueryparser.md) > [SearchParserResult](../interfaces/_index_d_.searchqueryparser.searchparserresult.md)
|
||||||
|
|
||||||
|
# Interface: SearchParserResult
|
||||||
|
|
||||||
|
## Hierarchy
|
||||||
|
|
||||||
|
[ISearchParserDictionary](_index_d_.searchqueryparser.isearchparserdictionary.md)
|
||||||
|
|
||||||
|
**↳ SearchParserResult**
|
||||||
|
|
||||||
|
## Indexable
|
||||||
|
|
||||||
|
\[key: `string`\]: `any`
|
||||||
|
## Index
|
||||||
|
|
||||||
|
### Properties
|
||||||
|
|
||||||
|
* [exclude](_index_d_.searchqueryparser.searchparserresult.md#exclude)
|
||||||
|
* [offsets](_index_d_.searchqueryparser.searchparserresult.md#offsets)
|
||||||
|
* [text](_index_d_.searchqueryparser.searchparserresult.md#text)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
<a id="exclude"></a>
|
||||||
|
|
||||||
|
### `<Optional>` exclude
|
||||||
|
|
||||||
|
**● exclude**: *[ISearchParserDictionary](_index_d_.searchqueryparser.isearchparserdictionary.md)*
|
||||||
|
|
||||||
|
*Defined in [index.d.ts:30](https://github.com/rtrvrtg/search-query-parser/blob/5612d18/index.d.ts#L30)*
|
||||||
|
|
||||||
|
___
|
||||||
|
<a id="offsets"></a>
|
||||||
|
|
||||||
|
### `<Optional>` offsets
|
||||||
|
|
||||||
|
**● offsets**: *[SearchParserOffset](_index_d_.searchqueryparser.searchparseroffset.md)[]*
|
||||||
|
|
||||||
|
*Defined in [index.d.ts:29](https://github.com/rtrvrtg/search-query-parser/blob/5612d18/index.d.ts#L29)*
|
||||||
|
|
||||||
|
___
|
||||||
|
<a id="text"></a>
|
||||||
|
|
||||||
|
### `<Optional>` text
|
||||||
|
|
||||||
|
**● text**: *`string` \| `string`[]*
|
||||||
|
|
||||||
|
*Defined in [index.d.ts:28](https://github.com/rtrvrtg/search-query-parser/blob/5612d18/index.d.ts#L28)*
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
12
docs/modules/_index_d_.md
Normal file
12
docs/modules/_index_d_.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[search-query-parser](../README.md) > ["index.d"](../modules/_index_d_.md)
|
||||||
|
|
||||||
|
# External module: "index.d"
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
### Modules
|
||||||
|
|
||||||
|
* [SearchQueryParser](_index_d_.searchqueryparser.md)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
40
docs/modules/_index_d_.searchqueryparser.md
Normal file
40
docs/modules/_index_d_.searchqueryparser.md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
[search-query-parser](../README.md) > ["index.d"](../modules/_index_d_.md) > [SearchQueryParser](../modules/_index_d_.searchqueryparser.md)
|
||||||
|
|
||||||
|
# Module: SearchQueryParser
|
||||||
|
|
||||||
|
## Index
|
||||||
|
|
||||||
|
### Interfaces
|
||||||
|
|
||||||
|
* [ISearchParserDictionary](../interfaces/_index_d_.searchqueryparser.isearchparserdictionary.md)
|
||||||
|
* [SearchParserOffset](../interfaces/_index_d_.searchqueryparser.searchparseroffset.md)
|
||||||
|
* [SearchParserOptions](../interfaces/_index_d_.searchqueryparser.searchparseroptions.md)
|
||||||
|
* [SearchParserResult](../interfaces/_index_d_.searchqueryparser.searchparserresult.md)
|
||||||
|
|
||||||
|
### Functions
|
||||||
|
|
||||||
|
* [parse](_index_d_.searchqueryparser.md#parse)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Functions
|
||||||
|
|
||||||
|
<a id="parse"></a>
|
||||||
|
|
||||||
|
### parse
|
||||||
|
|
||||||
|
▸ **parse**(string: *`string`*, options?: *[SearchParserOptions](../interfaces/_index_d_.searchqueryparser.searchparseroptions.md)*): `string` \| [SearchParserResult](../interfaces/_index_d_.searchqueryparser.searchparserresult.md)
|
||||||
|
|
||||||
|
*Defined in [index.d.ts:33](https://github.com/rtrvrtg/search-query-parser/blob/5612d18/index.d.ts#L33)*
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
|
||||||
|
| Name | Type |
|
||||||
|
| ------ | ------ |
|
||||||
|
| string | `string` |
|
||||||
|
| `Optional` options | [SearchParserOptions](../interfaces/_index_d_.searchqueryparser.searchparseroptions.md) |
|
||||||
|
|
||||||
|
**Returns:** `string` \| [SearchParserResult](../interfaces/_index_d_.searchqueryparser.searchparserresult.md)
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
10
index.d.ts
vendored
10
index.d.ts
vendored
@@ -5,7 +5,7 @@
|
|||||||
// Definitions: https://github.com/nepsilon/search-query-parser
|
// Definitions: https://github.com/nepsilon/search-query-parser
|
||||||
|
|
||||||
export module SearchQueryParser {
|
export module SearchQueryParser {
|
||||||
export interface SearchParserOptions {
|
interface SearchParserOptions {
|
||||||
offsets?: boolean;
|
offsets?: boolean;
|
||||||
tokenize?: boolean;
|
tokenize?: boolean;
|
||||||
keywords?: string[];
|
keywords?: string[];
|
||||||
@@ -13,22 +13,22 @@ export module SearchQueryParser {
|
|||||||
alwaysArray?: boolean;
|
alwaysArray?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISearchParserDictionary {
|
interface ISearchParserDictionary {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SearchParserOffset {
|
interface SearchParserOffset {
|
||||||
keyword: string;
|
keyword: string;
|
||||||
value?: string;
|
value?: string;
|
||||||
offsetStart: number;
|
offsetStart: number;
|
||||||
offsetEnd: number;
|
offsetEnd: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SearchParserResult extends ISearchParserDictionary {
|
interface SearchParserResult extends ISearchParserDictionary {
|
||||||
text?: string | string[];
|
text?: string | string[];
|
||||||
offsets?: SearchParserOffset[];
|
offsets?: SearchParserOffset[];
|
||||||
exclude?: ISearchParserDictionary;
|
exclude?: ISearchParserDictionary;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function parse(string: string, options?: SearchParserOptions): string | SearchParserResult;
|
function parse(string: string, options?: SearchParserOptions): string | SearchParserResult;
|
||||||
}
|
}
|
||||||
|
|||||||
1074
package-lock.json
generated
1074
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -26,6 +26,8 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"mocha": "*",
|
"mocha": "*",
|
||||||
"should": "^3.2.0",
|
"should": "^3.2.0",
|
||||||
|
"typedoc": "^0.14.2",
|
||||||
|
"typedoc-plugin-markdown": "^1.1.27",
|
||||||
"typescript": "^3.3.3333"
|
"typescript": "^3.3.3333"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,16 @@
|
|||||||
"include": [
|
"include": [
|
||||||
"./lib/**/*"
|
"./lib/**/*"
|
||||||
],
|
],
|
||||||
"exclude": []
|
"exclude": [],
|
||||||
|
"typedocOptions": {
|
||||||
|
"mode": "modules",
|
||||||
|
"out": "docs",
|
||||||
|
"include": "./lib",
|
||||||
|
"exclude": ["./node_modules/**/*"],
|
||||||
|
"module": "commonjs",
|
||||||
|
"target": "es5",
|
||||||
|
"includeDeclarations": true,
|
||||||
|
"theme": "markdown",
|
||||||
|
"readme": "none"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user