From ccc8e66adbc1b4d0008782efde1ab634cabd4941 Mon Sep 17 00:00:00 2001 From: Geoffrey Roberts Date: Fri, 1 Mar 2019 15:40:07 +1100 Subject: [PATCH] Initial pass at typescript typings --- index.d.ts | 26 ++++++++++++++++++++++++++ package-lock.json | 14 ++++++++++++++ package.json | 3 ++- tsconfig.json | 14 ++++++++++++++ tslint.json | 3 +++ 5 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 index.d.ts create mode 100644 package-lock.json create mode 100644 tsconfig.json create mode 100644 tslint.json diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..8ae90ce --- /dev/null +++ b/index.d.ts @@ -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; diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..a373a79 --- /dev/null +++ b/package-lock.json @@ -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 + } + } +} diff --git a/package.json b/package.json index 87b5a35..3ccc0d3 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,8 @@ }, "homepage": "https://github.com/nepsilon/search-query-parser", "devDependencies": { + "mocha": "*", "should": "^3.2.0", - "mocha": "*" + "typescript": "^3.3.3333" } } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..a2e16e7 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "composite": true, + "sourceMap": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "./lib/**/*" + ], + "exclude": [] +} \ No newline at end of file diff --git a/tslint.json b/tslint.json new file mode 100644 index 0000000..30a1bdd --- /dev/null +++ b/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file