[fix] #87 Add stripColors method for backwards compat

This commit is contained in:
Marak 2014-10-09 11:56:30 +02:00
parent ac1429ddf3
commit 8046bf032c
2 changed files with 6 additions and 1 deletions

View File

@ -42,10 +42,11 @@ if (typeof colors.enabled === "undefined") {
colors.enabled = colors.supportsColor;
}
colors.strip = function(str){
colors.stripColors = colors.strip = function(str){
return ("" + str).replace(/\x1B\[\d+m/g, '');
};
var stylize = colors.stylize = function stylize (str, style) {
return ansiStyles[style].open + str + ansiStyles[style].close;
}

View File

@ -26,6 +26,10 @@ module['exports'] = function () {
return colors.strip(this);
});
addProperty('stripColors', function () {
return colors.strip(this);
});
addProperty("trap", function(){
return colors.trap(this);
});