mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-29 08:58:23 +08:00
fuzzaldrin-plus typings
This commit is contained in:
20
fuzzaldrin-plus/fuzzaldrin-plus-tests.ts
Normal file
20
fuzzaldrin-plus/fuzzaldrin-plus-tests.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import * as fz from "fuzzaldrin-plus";
|
||||
|
||||
const candidates = [
|
||||
'Find And Replace: Select All',
|
||||
'Settings View: Uninstall Packages',
|
||||
'Settings View: View Installed Themes',
|
||||
'Application: Install Update',
|
||||
'Install'
|
||||
]
|
||||
const objectCandidates = candidates.map(s => ({ foo: s }));
|
||||
|
||||
fz.filter(candidates, 'install');
|
||||
fz.filter(objectCandidates, 'install', { key: 'foo' });
|
||||
|
||||
const prepQuery = fz.prepQuery('install');
|
||||
fz.score('Application: Install Update', 'install');
|
||||
fz.score('Application: Install Update', 'install', prepQuery);
|
||||
|
||||
fz.match('Application: Install Update', 'install');
|
||||
fz.match('Application: Install Update', 'install', prepQuery);
|
||||
29
fuzzaldrin-plus/index.d.ts
vendored
Normal file
29
fuzzaldrin-plus/index.d.ts
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
// Type definitions for fuzzaldrin-plus
|
||||
// Project: https://github.com/jeancroy/fuzzaldrin-plus/
|
||||
// Definitions by: Jean Christophe Roy <https://github.com/jeancroy>, Jason Killian <https://github.com/jkillian>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export as namespace fuzzaldrin;
|
||||
|
||||
export interface IQueryOptions {
|
||||
pathSeparator?: string;
|
||||
optCharRegEx?: RegExp;
|
||||
}
|
||||
|
||||
export interface IScoringOptions extends IQueryOptions {
|
||||
allowErrors?: boolean;
|
||||
isPath?: boolean;
|
||||
useExtensionBonus?: boolean;
|
||||
}
|
||||
|
||||
export interface IFilterOptions extends IScoringOptions {
|
||||
key?: string;
|
||||
maxResults?: number;
|
||||
}
|
||||
|
||||
export type PreparedQuery = { __internalAPIBrand: string; };
|
||||
|
||||
export function filter<T>(data: T[], query: string, options?: IFilterOptions): T[];
|
||||
export function score(str: string, query: string, preparedQuery?: PreparedQuery, options?: IScoringOptions): number;
|
||||
export function match(str: string, query: string, preparedQuery?: PreparedQuery, options?: IScoringOptions): number[];
|
||||
export function prepQuery(query: string, options?: IQueryOptions): PreparedQuery;
|
||||
19
fuzzaldrin-plus/tsconfig.json
Normal file
19
fuzzaldrin-plus/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"fuzzaldrin-plus-tests.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user