mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 21:00:01 +08:00
fuse: remove typings
This commit is contained in:
@@ -558,6 +558,12 @@
|
||||
"sourceRepoURL": "http://arshaw.com/fullcalendar/",
|
||||
"asOfVersion": "3.8.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "fuse",
|
||||
"typingsPackageName": "fuse",
|
||||
"sourceRepoURL": "https://github.com/krisk/Fuse",
|
||||
"asOfVersion": "2.6.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "gaea-model",
|
||||
"typingsPackageName": "gaea-model",
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
|
||||
|
||||
function test_fuse_find_identifiers() {
|
||||
var books = [{
|
||||
id: 1,
|
||||
title: 'The Great Gatsby',
|
||||
author: 'F. Scott Fitzgerald'
|
||||
}, {
|
||||
id: 2,
|
||||
title: 'The DaVinci Code',
|
||||
author: 'Dan Brown'
|
||||
}, {
|
||||
id: 3,
|
||||
title: 'Angels & Demons',
|
||||
author: 'Dan Brown'
|
||||
}];
|
||||
var options = {
|
||||
keys: ['author', 'title'], // keys to search in
|
||||
id: 'id' // return a list of identifiers only
|
||||
};
|
||||
var f = new Fuse(books, options);
|
||||
var result = f.search('brwn'); // Fuzzy-search for pattern 'brwn'
|
||||
}
|
||||
|
||||
function test_fuse_find_records() {
|
||||
var books = [{
|
||||
id: 1,
|
||||
title: 'The Great Gatsby',
|
||||
author: 'F. Scott Fitzgerald'
|
||||
}, {
|
||||
id: 2,
|
||||
title: 'The DaVinci Code',
|
||||
author: 'Dan Brown'
|
||||
}, {
|
||||
id: 3,
|
||||
title: 'Angels & Demons',
|
||||
author: 'Dan Brown'
|
||||
}];
|
||||
var options = {
|
||||
keys: ['author', 'title']
|
||||
};
|
||||
var f = new Fuse(books, options);
|
||||
var result = f.search('brwn');
|
||||
}
|
||||
|
||||
function test_fuse_flat_array() {
|
||||
var books = ["Old Man's War", "The Lock Artist", "HTML5", "Right Ho Jeeves", "The Code of the Wooster", "Thank You Jeeves", "The DaVinci Code", "Angels & Demons", "The Silmarillion", "Syrup", "The Lost Symbol", "The Book of Lies", "Lamb", "Fool", "Incompetence", "Fat", "Colony", "Backwards, Red Dwarf", "The Grand Design", "The Book of Samson", "The Preservationist", "Fallen", "Monster 1959"];
|
||||
var f = new Fuse(books);
|
||||
var result = f.search('Falen');
|
||||
}
|
||||
|
||||
function test_fuse_deep_key_search() {
|
||||
var books = [{
|
||||
id: 1,
|
||||
title: 'The Great Gatsby',
|
||||
author: {
|
||||
firstName: 'F. Scott',
|
||||
lastName: 'Fitzgerald'
|
||||
}
|
||||
}, {
|
||||
title: 'The DaVinci Code',
|
||||
author: {
|
||||
firstName: 'Dan',
|
||||
lastName: 'Brown'
|
||||
}
|
||||
}];
|
||||
|
||||
var options = {
|
||||
keys: ['author.firstName']
|
||||
};
|
||||
var f = new Fuse(books, options);
|
||||
var result = f.search('brwn');
|
||||
}
|
||||
|
||||
interface Book {
|
||||
id?: number;
|
||||
title?: string;
|
||||
author?: {firstName: string; lastName: string};
|
||||
}
|
||||
|
||||
function test_generic_fuse() {
|
||||
var books: Book[] = [{
|
||||
id: 1,
|
||||
title: 'The Great Gatsby',
|
||||
author: {
|
||||
firstName: 'F. Scott',
|
||||
lastName: 'Fitzgerald'
|
||||
}
|
||||
}, {
|
||||
title: 'The DaVinci Code',
|
||||
author: {
|
||||
firstName: 'Dan',
|
||||
lastName: 'Brown'
|
||||
}
|
||||
}];
|
||||
|
||||
var options = {
|
||||
keys: ["title", "author.firstName"]
|
||||
};
|
||||
var f = new Fuse<Book>(books, options);
|
||||
var result = f.search('brwn');
|
||||
}
|
||||
|
||||
function test_getFn() {
|
||||
var books = [{
|
||||
id: 1,
|
||||
title: 'The Great Gatsby',
|
||||
author: {
|
||||
firstName: 'F. Scott',
|
||||
lastName: 'Fitzgerald'
|
||||
}
|
||||
}, {
|
||||
title: 'The DaVinci Code',
|
||||
author: {
|
||||
firstName: 'Dan',
|
||||
lastName: 'Brown'
|
||||
}
|
||||
}];
|
||||
|
||||
var options = {
|
||||
keys: ["title", "author.firstName"],
|
||||
getFn: (obj: Book, path: string): string => {
|
||||
if (!obj) {
|
||||
return null;
|
||||
}
|
||||
return obj.author.firstName;
|
||||
}
|
||||
};
|
||||
var f = new Fuse<Book>(books, options);
|
||||
}
|
||||
54
types/fuse/index.d.ts
vendored
54
types/fuse/index.d.ts
vendored
@@ -1,54 +0,0 @@
|
||||
// Type definitions for Fuse.js 2.5.0
|
||||
// Project: https://github.com/krisk/Fuse
|
||||
// Definitions by: Greg Smith <https://github.com/smrq>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare class Fuse<T> {
|
||||
constructor(list: T[], options?: Fuse.Options<T>);
|
||||
search(pattern: string): T[];
|
||||
}
|
||||
|
||||
declare namespace Fuse {
|
||||
interface SearchFnConstructor {
|
||||
new (pattern: string, options?: SearchOptions): SearchFn;
|
||||
}
|
||||
|
||||
interface SearchFn {
|
||||
search(text: string): SearchResult;
|
||||
}
|
||||
|
||||
interface SearchResult {
|
||||
readonly isMatch: boolean;
|
||||
readonly score: number;
|
||||
}
|
||||
|
||||
interface SearchOptions {
|
||||
location?: number;
|
||||
distance?: number;
|
||||
threshold?: number;
|
||||
maxPatternLength?: number;
|
||||
}
|
||||
|
||||
interface Options<T> {
|
||||
id?: string;
|
||||
caseSensitive?: boolean;
|
||||
include?: string[];
|
||||
shouldSort?: boolean;
|
||||
searchFn?: SearchFnConstructor;
|
||||
sortFn?: (a: {score: number}, b: {score: number}) => number;
|
||||
keys?: string[] | { name:string; weight:number} [];
|
||||
verbose?:boolean;
|
||||
tokenize?: boolean;
|
||||
tokenSeparator? : RegExp;
|
||||
matchAllTokens?: boolean;
|
||||
location?: number;
|
||||
distance?: number;
|
||||
threshold?: number;
|
||||
maxPatternLength?: number;
|
||||
includeScore?: boolean;
|
||||
getFn?: (obj: T, path: string) => string;
|
||||
}
|
||||
}
|
||||
|
||||
export = Fuse;
|
||||
export as namespace Fuse;
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"fuse-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user