rich-console
Advanced tools
Comparing version 0.0.1 to 0.0.2
27
index.js
@@ -11,3 +11,3 @@ /** | ||
var fontStyle = isBright == true ? '\033[1m' : ''; | ||
var fontStyle = isBright == true ? '\u001b[1m' : ''; | ||
var ESCAPES = { | ||
@@ -42,4 +42,8 @@ black : (fontStyle + '\u001b[30m'), | ||
var style = ESCAPES[$2]; | ||
styleStack.push(style); | ||
return style; | ||
if(style){ | ||
styleStack.push(style); | ||
return style; | ||
}else{ | ||
return m; | ||
} | ||
} | ||
@@ -49,8 +53,15 @@ | ||
// 栈顶样式,若栈为空返回系统默认样式 | ||
if ($3) { | ||
styleStack.pop(); | ||
var len = styleStack.length; | ||
var topStyle = len > 0 ? styleStack[len - 1] : null; | ||
return (topStyle ? topStyle : NO_COLOR); | ||
if ($3) { | ||
if(ESCAPES[$2]){ | ||
styleStack.pop(); | ||
var len = styleStack.length; | ||
var topStyle = len > 0 ? styleStack[len - 1] : null; | ||
return (topStyle ? topStyle : NO_COLOR); | ||
}else{ | ||
return m; | ||
} | ||
} | ||
// others | ||
return m; | ||
}) + NO_COLOR; // 最末尾的两个重置用来防止用户标签不闭合进而污染整个控制台输出 | ||
@@ -57,0 +68,0 @@ }; |
{ | ||
"name": "rich-console", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "author": "keven-wang", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5663
109