1
0

Initial pass at typescript typings

This commit is contained in:
Geoffrey Roberts
2019-03-01 15:40:07 +11:00
parent 60c81e2b69
commit ccc8e66adb
5 changed files with 59 additions and 1 deletions

26
index.d.ts vendored Normal file
View File

@@ -0,0 +1,26 @@
export interface SearchParserOptions {
offsets?: boolean;
tokenize?: boolean;
keywords?: string[];
ranges?: string[];
alwaysArray?: boolean;
}
export interface ISearchParserDictionary {
[key: string]: any;
}
export interface SearchParserOffset {
keyword: string;
value?: string;
offsetStart: number;
offsetEnd: number;
}
export interface SearchParserResult extends ISearchParserDictionary {
text?: string;
offsets?: SearchParserOffset[];
exclude?: ISearchParserDictionary;
}
export function parse(string: string, options?: SearchParserOptions): string | SearchParserResult;

14
package-lock.json generated Normal file
View File

@@ -0,0 +1,14 @@
{
"name": "search-query-parser",
"version": "1.4.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"typescript": {
"version": "3.3.3333",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.3.3333.tgz",
"integrity": "sha512-JjSKsAfuHBE/fB2oZ8NxtRTk5iGcg6hkYXMnZ3Wc+b2RSqejEqTaem11mHASMnFilHrax3sLK0GDzcJrekZYLw==",
"dev": true
}
}
}

View File

@@ -24,7 +24,8 @@
}, },
"homepage": "https://github.com/nepsilon/search-query-parser", "homepage": "https://github.com/nepsilon/search-query-parser",
"devDependencies": { "devDependencies": {
"mocha": "*",
"should": "^3.2.0", "should": "^3.2.0",
"mocha": "*" "typescript": "^3.3.3333"
} }
} }

14
tsconfig.json Normal file
View File

@@ -0,0 +1,14 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"composite": true,
"sourceMap": true,
"declaration": true,
"declarationMap": true
},
"include": [
"./lib/**/*"
],
"exclude": []
}

3
tslint.json Normal file
View File

@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}