mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add type definitions for searchjs (#43370)
* Added type definitions for searchjs * Reformatted code * Applied fixes from linter * Remove tslint additional rules * Removed package.json * Added more types to anotations * Updated tests
This commit is contained in:
parent
24cc8a2f95
commit
e429922c9c
24
types/searchjs/index.d.ts
vendored
Normal file
24
types/searchjs/index.d.ts
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
// Type definitions for searchjs 1.0
|
||||
// Project: https://github.com/deitch/searchjs
|
||||
// Definitions by: Melvin Mupondori <https://github.com/iammerus>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export function setDefaults(options: {
|
||||
negator: boolean;
|
||||
joinAnd: string;
|
||||
text: boolean;
|
||||
word: boolean;
|
||||
start: boolean;
|
||||
end: boolean;
|
||||
separator: string;
|
||||
propertySearch: boolean;
|
||||
propertySearchDepth: number;
|
||||
}): void;
|
||||
|
||||
export function resetDefaults(): void;
|
||||
|
||||
export function singleMatch(field: any, s: any, text: boolean, word: boolean, start: boolean, end: boolean): any;
|
||||
|
||||
export function matchArray(ary: any[], search: any): any;
|
||||
|
||||
export function matchObject(obj: any, search: any): any;
|
||||
25
types/searchjs/searchjs-tests.ts
Normal file
25
types/searchjs/searchjs-tests.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { resetDefaults, setDefaults, matchArray, matchObject } from 'searchjs';
|
||||
|
||||
resetDefaults();
|
||||
|
||||
setDefaults({
|
||||
negator: false,
|
||||
joinAnd: "AND",
|
||||
text: false,
|
||||
word: false,
|
||||
start: false,
|
||||
end: false,
|
||||
separator: ".",
|
||||
propertySearch: false,
|
||||
propertySearchDepth: -1
|
||||
});
|
||||
|
||||
matchArray(
|
||||
[
|
||||
{ a: '1234', b: 56 },
|
||||
{ a: 'Hello!', b: 11 },
|
||||
],
|
||||
{ a: 'Hello!' },
|
||||
);
|
||||
|
||||
matchObject({ stuff: 'This is some awesome stuff' }, 'some awesome stuff');
|
||||
24
types/searchjs/tsconfig.json
Normal file
24
types/searchjs/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"searchjs-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/searchjs/tslint.json
Normal file
3
types/searchjs/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user