fix --no-color is not work

This commit is contained in:
xiangshouding 2014-12-16 16:17:42 +08:00
parent e9e6557cc0
commit f6ebbfe14c
2 changed files with 5 additions and 7 deletions

View File

@ -48,6 +48,9 @@ colors.stripColors = colors.strip = function(str){
var stylize = colors.stylize = function stylize (str, style) {
if (!colors.enabled) {
return str+'';
}
return ansiStyles[style].open + str + ansiStyles[style].close;
}

View File

@ -1,5 +1,4 @@
var colors = require('./colors'),
styles = require('./styles');
var colors = require('./colors');
module['exports'] = function () {
@ -18,10 +17,6 @@ module['exports'] = function () {
}
};
var stylize = function stylize (str, style) {
return styles[style].open + str + styles[style].close;
}
addProperty('strip', function () {
return colors.strip(this);
});
@ -60,7 +55,7 @@ module['exports'] = function () {
var x = Object.keys(colors.styles);
x.forEach(function (style) {
addProperty(style, function () {
return stylize(this, style);
return colors.stylize(this, style);
});
});