ansi-rainbow
Advanced tools
Comparing version 0.0.5 to 0.0.6
22
index.js
@@ -134,7 +134,9 @@ var ansi = require('ansi-styles') | ||
}, | ||
isSpace: function(c) { | ||
return c == ' ' || c.match('\s') | ||
}, | ||
isNewLine: function(c) { | ||
return c == '\n' | ||
}, | ||
nextColor: function(s, colors) { | ||
//not a space | ||
if(!this.options.color_space && s == ' ') { | ||
return s | ||
} | ||
@@ -162,6 +164,2 @@ var l = colors.length - 1 | ||
if(!this.options.color_space && s == ' ') { | ||
return s | ||
} | ||
this._current_gap++ | ||
@@ -183,3 +181,9 @@ | ||
this._current_gap = this._current_gap > gap ? 1 : this._current_gap | ||
output += this._current_gap == gap ? this.nextColor(input.charAt(i), colors) : this.currentColor(input.charAt(i), colors) | ||
s = input.charAt(i) | ||
if(!this.options.color_space && this.isSpace(s) || this.isNewLine(s)) { | ||
output += s | ||
} else { | ||
output += this._current_gap == gap ? this.nextColor(s, colors) : this.currentColor(s, colors) | ||
} | ||
} | ||
@@ -186,0 +190,0 @@ |
{ | ||
"name": "ansi-rainbow", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Ainsi rainbowify", | ||
@@ -8,3 +8,3 @@ "main": "index.js", | ||
"scripts": { | ||
"test": "mocha test.js --reporter spec" | ||
"test": "mocha --reporter spec" | ||
}, | ||
@@ -25,4 +25,5 @@ "keywords": [ | ||
"mocha": "~1.18.2", | ||
"chalk": "~0.4.0" | ||
"chalk": "~0.4.0", | ||
"through2": "^0.4.1" | ||
} | ||
} |
@@ -46,3 +46,3 @@ ansi-rainbow | ||
.skip(rainbow._backgrounds) //skips backgrounds | ||
.add('bgBlue bgMagenta bgCyan') | ||
.add('bgBlue bgMagenta bgCyan') //this will keep order when rainbowified | ||
.options({color_space: true, gap: 3}) //this will force color spaces and change color every 3 characters | ||
@@ -49,0 +49,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17472
8
223
4
2