Add ansi-regex package

This commit is contained in:
Manish Vachharajani
2017-11-28 12:49:28 -07:00
parent c63dd9d46c
commit c5dc464c6e
4 changed files with 44 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
import ansiRegex = require("ansi-regex");
ansiRegex(); // $ExpectType RegExp
// From the ansi-regex README.md
ansiRegex().test('\u001B[4mcake\u001B[0m'); // $ExpectType boolean
// => true
ansiRegex().test('cake'); // $ExpectType boolean
// => false
'\u001B[4mcake\u001B[0m'.match(ansiRegex()); // $ExpectType RegExpMatchArray | null
// => ['\u001B[4m', '\u001B[0m']

7
types/ansi-regex/index.d.ts vendored Normal file
View File

@@ -0,0 +1,7 @@
// Type definitions for ansi-regex 3.0
// Project: https://github.com/chalk/ansi-regex#readme
// Definitions by: Manish Vachharajani <https://github.com/mvachhar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function r(): RegExp;
export = r;

View File

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

View File

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