diff --git a/colors.js b/colors.js index 44ee612..96c436f 100644 --- a/colors.js +++ b/colors.js @@ -98,7 +98,7 @@ function stylize(str, style) { 'yellow' : ['', ''] }; } else if (exports.mode === 'none') { - return str; + return str+''; } else { console.log('unsupported mode, try "browser", "console" or "none"'); } diff --git a/test.js b/test.js index 1c03d65..d74432a 100644 --- a/test.js +++ b/test.js @@ -46,6 +46,11 @@ aE(s, 'red', 31); aE(s, 'yellow', 33); assert.equal(s, 'string'); +colors.setTheme({error:'red'}); + +assert.equal(typeof("astring".red),'string'); +assert.equal(typeof("astring".error),'string'); + colors.mode = 'browser'; assert.equal(s.bold, '' + s + ''); assert.equal(s.italic, '' + s + ''); @@ -57,9 +62,14 @@ stylesColors.forEach(function (color) { assert.equal(colors[color](s), h(s, color)); }); +assert.equal(typeof("astring".red),'string'); +assert.equal(typeof("astring".error),'string'); + colors.mode = 'none'; stylesAll.forEach(function (style) { assert.equal(s[style], s); assert.equal(colors[style](s), s); }); +assert.equal(typeof("astring".red),'string'); +assert.equal(typeof("astring".error),'string');