Update supports-colors.js

This commit is contained in:
paladox 2018-02-14 00:47:45 +00:00 committed by GitHub
parent 34a3d33de1
commit 2dc605c8cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,10 +24,10 @@ THE SOFTWARE.
*/ */
'use strict'; 'use strict';
const os = require('os'); var os = require('os');
const hasFlag = require('./has-flag.js'); var hasFlag = require('./has-flag.js');
const env = process.env; var env = process.env;
let forceColor; let forceColor;
if (hasFlag('no-color') || if (hasFlag('no-color') ||
@ -85,7 +85,7 @@ function supportsColor(stream) {
// release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
// release that supports 256 colors. Windows 10 build 14931 is the first release // release that supports 256 colors. Windows 10 build 14931 is the first release
// that supports 16m/TrueColor. // that supports 16m/TrueColor.
const osRelease = os.release().split('.'); var osRelease = os.release().split('.');
if ( if (
Number(process.versions.node.split('.')[0]) >= 8 && Number(process.versions.node.split('.')[0]) >= 8 &&
Number(osRelease[0]) >= 10 && Number(osRelease[0]) >= 10 &&
@ -110,7 +110,7 @@ function supportsColor(stream) {
} }
if ('TERM_PROGRAM' in env) { if ('TERM_PROGRAM' in env) {
const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); var version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
switch (env.TERM_PROGRAM) { switch (env.TERM_PROGRAM) {
case 'iTerm.app': case 'iTerm.app':