diff --git a/fuzzy.d.ts b/fuzzy.d.ts new file mode 100644 index 0000000..352322d --- /dev/null +++ b/fuzzy.d.ts @@ -0,0 +1,16 @@ +export interface FuzzyOptions { + caseSensitive?: boolean; + before?: string; + after?: string; +} + +export interface FuzzyResult { + score: number; + result: string; +} + +declare function test(pattern: string, str: string, caseSensitive?: boolean): boolean; +declare function match(pattern: string, str: string, options?: FuzzyOptions): FuzzyResult; +declare function filter(pattern: string, strs: Array, options?: FuzzyOptions): Array; + +export { test, match, filter }; diff --git a/package.json b/package.json index 617bb67..6b16a71 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fuzzyjs", - "version": "2.0.0", + "version": "2.1.0", "description": "fuzzyjs is a fuzzy search algorithm in javascript", "main": "build/fuzzy.js", "directories": { @@ -37,5 +37,9 @@ "bugs": { "url": "https://github.com/gjuchault/fuzzyjs/issues" }, - "homepage": "https://github.com/gjuchault/fuzzyjs#readme" + "homepage": "https://github.com/gjuchault/fuzzyjs#readme", + "typings": "./fuzzy.d.ts", + "typescript": { + "definition": "./fuzzy.d.ts" + } }