mirror of
https://github.com/flynx/colors.js.git
synced 2025-11-02 04:50:09 +00:00
[fix] #87 Add stripColors method for backwards compat
This commit is contained in:
parent
ac1429ddf3
commit
8046bf032c
@ -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;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user