[wildstring]: Add v1 types (#39110)

This commit is contained in:
inglec-arista 2019-10-15 23:37:11 +01:00 committed by Andrew Branch
parent 8e022c857b
commit e1b26ffc11
4 changed files with 52 additions and 0 deletions

17
types/wildstring/index.d.ts vendored Normal file
View File

@ -0,0 +1,17 @@
// Type definitions for wildstring 1.0
// Project: https://github.com/deltreey/wildstring#readme
// Definitions by: Ciarán Ingle <https://github.com/inglec-arista>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare const wildstring: {
wildcard: string;
caseSensitive: boolean;
match: (pattern: string, string: string) => boolean;
replace: (pattern: string, strings: string | ReadonlyArray<string>) => string;
};
export {};
export = wildstring;

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"wildstring-tests.ts"
]
}

View File

@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}

View File

@ -0,0 +1,9 @@
import wildstring = require('wildstring');
wildstring.wildcard = '*';
wildstring.caseSensitive = true;
wildstring.match('Test*', 'Testing');
wildstring.replace('I * node.*', 'script');
wildstring.replace('I * node.*', [ 'love', 'js' ]);