Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: colors update ternary to if else #55700

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions lib/internal/util/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,28 @@
stream.getColorDepth() > 2 : true);
},
refresh() {
const hasColors = module.exports.shouldColorize(process.stderr);
module.exports.blue = hasColors ? '\u001b[34m' : '';
module.exports.green = hasColors ? '\u001b[32m' : '';
module.exports.white = hasColors ? '\u001b[39m' : '';
module.exports.yellow = hasColors ? '\u001b[33m' : '';
module.exports.red = hasColors ? '\u001b[31m' : '';
module.exports.gray = hasColors ? '\u001b[90m' : '';
module.exports.clear = hasColors ? '\u001bc' : '';
module.exports.reset = hasColors ? '\u001b[0m' : '';
module.exports.hasColors = hasColors;
},
if (module.exports.shouldColorize(process.stderr)) {
module.exports.blue = '\u001b[34m';
module.exports.green = '\u001b[32m';
module.exports.white = '\u001b[39m';
module.exports.yellow = '\u001b[33m';
module.exports.red = '\u001b[31m';
module.exports.gray = '\u001b[90m';
module.exports.clear = '\u001bc';
module.exports.reset = '\u001b[0m';
module.exports.hasColors = true;
} else {
module.exports.blue = '';
module.exports.green = '';
module.exports.white = '';
module.exports.yellow = '';
module.exports.red = '';
module.exports.gray = '';
module.exports.clear = '';
module.exports.reset = '';
module.exports.hasColors = false;
}
}

Check failure on line 48 in lib/internal/util/colors.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Missing trailing comma
};

module.exports.refresh();
Loading