mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
lib: refactor code to improve readability
PR-URL: https://github.com/nodejs/node/pull/55995 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name>
This commit is contained in:
@@ -24,16 +24,27 @@ module.exports = {
|
||||
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;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user