diff --git a/lib/colors.js b/lib/colors.js index 156879f..59898de 100644 --- a/lib/colors.js +++ b/lib/colors.js @@ -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; } diff --git a/lib/extendStringPrototype.js b/lib/extendStringPrototype.js index 241157d..b6b5b03 100644 --- a/lib/extendStringPrototype.js +++ b/lib/extendStringPrototype.js @@ -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); });