Permalink
Browse files

[refactor] Check presence in color arrays instead of range

  • Loading branch information...
1 parent a830963 commit e7ef9dbaeae3477b032ffc35362909c17b96185e @mmalecki committed Dec 4, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/ansiparse.js
View
@@ -64,10 +64,10 @@ ansiparse = function (str) {
// TODO: DRY.
//
ansiState.forEach(function (ansiCode) {
- if ((30 <= ansiCode) && (ansiCode <= 37)) {
+ if (ansiparse.foregroundColors[ansiCode]) {
state.foreground = ansiparse.foregroundColors[ansiCode];
}
- else if ((40 <= ansiCode) && (ansiCode <= 47)) {
+ else if (ansiparse.backgroundColors[ansiCode]) {
state.background = ansiparse.backgroundColors[ansiCode];
}
else if (ansiCode == 39) {

0 comments on commit e7ef9db

Please sign in to comment.