forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a18708
commit 402741f
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/// <reference path="ansi-styles.d.ts" /> | ||
|
||
import ansi = require('ansi-styles'); | ||
|
||
|
||
var styles = [ | ||
ansi.reset, | ||
|
||
ansi.bold, | ||
ansi.dim, | ||
ansi.italic, | ||
ansi.underline, | ||
ansi.inverse, | ||
ansi.hidden, | ||
ansi.strikethrough, | ||
|
||
ansi.black, | ||
ansi.red, | ||
ansi.green, | ||
ansi.yellow, | ||
ansi.blue, | ||
ansi.magenta, | ||
ansi.cyan, | ||
ansi.white, | ||
ansi.gray, | ||
|
||
ansi.bgBlack, | ||
ansi.bgRed, | ||
ansi.bgGreen, | ||
ansi.bgYellow, | ||
ansi.bgBlue, | ||
ansi.bgMagenta, | ||
ansi.bgCyan, | ||
ansi.bgWhite | ||
] | ||
|
||
for (var key in styles) { | ||
check(key, styles[key]) | ||
} | ||
|
||
function check(key:string, escapeCodes:ansi.EscapeCodePair): void { | ||
if (uninitialized(escapeCodes.open)) { | ||
throw new Error('key not found ~> ' + key + '.open') | ||
} | ||
if (uninitialized(escapeCodes.close)) { | ||
throw new Error('key not found ~> ' + key + '.close') | ||
} | ||
} | ||
|
||
function uninitialized(val:any): boolean { | ||
return val === null || val === undefined | ||
} | ||
|
||
|