Merge pull request #21886 from forabi/add-fuzzysetjs

Add types for fuzzyset.js
This commit is contained in:
Mine Starks
2017-12-11 10:58:18 -08:00
committed by GitHub
4 changed files with 57 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
import FuzzySet = require('fuzzyset.js');
const fuzzyset: FuzzySet = FuzzySet(['coucou', 'foo', 'bar', 'toto']);
const results = fuzzyset.get('foo');
fuzzyset.length();
fuzzyset.isEmpty();
fuzzyset.values();
+23
View File
@@ -0,0 +1,23 @@
// Type definitions for fuzzyset.js 0.0
// Project: https://github.com/Glench/fuzzyset.js
// Definitions by: Louis Grignon <https://github.com/lgrignon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
interface FuzzySet {
get<T = undefined>(candidate: string, defaultValue?: T, minScore?: number): Array<[number, string]> | T | null;
add(value: string): boolean;
length(): number;
isEmpty(): boolean;
values(): string[];
}
declare function FuzzySet(
source: string[],
useLevenshtein?: boolean,
gramSizeLower?: number,
gramSizeUpper?: number,
): FuzzySet;
export = FuzzySet;
export as namespace FuzzySet;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"fuzzyset.js-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }