Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/streaka/colors.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Pike committed Apr 26, 2018
2 parents 21448e0 + 0a5a26c commit dfe6290
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,15 @@ function applyStyle() {
return str;
}

var newLinesPresent = false;
if(str.indexOf('\n') != -1){
newLinesPresent = true;
}
var newLinesPresent = str.indexOf('\n') != -1;

var nestedStyles = this._styles;

var i = nestedStyles.length;
while (i--) {
var code = ansiStyles[nestedStyles[i]];
str = code.open + str.replace(code.closeRe, code.open) + code.close;
if(newLinesPresent){
if (newLinesPresent){
str = str.replace(newLineRegex, code.close + '\n' + code.open);
}
}
Expand Down

0 comments on commit dfe6290

Please sign in to comment.