feat(globalyzer): new type definition (#43827)

- type definition
- tests

https://github.com/terkelg/globalyzer#api

Thanks!
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz)
2020-04-13 16:21:57 -07:00
committed by GitHub
parent 621363e730
commit 8d4dd52d26
4 changed files with 57 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
import globalyzer = require('globalyzer');
globalyzer('foo/bar/.git/'); // $ExpectType { base: string; glob: string; isGlob: boolean; }
// => { base: 'foo/bar/.git/', glob: '', isGlob: false }
globalyzer('foo/bar/**/baz'); // $ExpectType { base: string; glob: string; isGlob: boolean; }
// => { base: 'foo/bar', glob: '**/baz', isGlob: true }
+26
View File
@@ -0,0 +1,26 @@
// Type definitions for globalyzer 0.1
// Project: https://github.com/terkelg/globalyzer#readme
// Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Detect and extract the static part of a glob string.
* Utility to detect if a string contains a glob and then split it in a glob and none-glob part.
* @param pattern - Glob string to analyze
*/
declare function globalyzer(
glob: string,
options?: {
/**
* Use strict parsing (be strict about what's a glob and what's not)
* @default false
*/
strict?: boolean;
},
): {
base: string;
glob: string;
isGlob: boolean;
};
export = globalyzer;
+23
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",
"globalyzer-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }