mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #21886 from forabi/add-fuzzysetjs
Add types for fuzzyset.js
This commit is contained in:
@@ -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();
|
||||
Vendored
+23
@@ -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;
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user