Skip to content

Commit 6894dbd

Browse files
committed
ensure process is defined
1 parent 64189b1 commit 6894dbd

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ const isObject = val => val !== null && typeof val === 'object' && !Array.isArra
66
// this is a modified version of https://github.com/chalk/ansi-regex (MIT License)
77
const ANSI_REGEX = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g;
88

9+
const hasColor = () => {
10+
if (typeof process !== 'undefined') {
11+
return process.env.FORCE_COLOR !== '0';
12+
}
13+
return false;
14+
};
15+
916
const create = () => {
1017
const colors = {
11-
enabled: process.env.FORCE_COLOR !== '0',
18+
enabled: hasColor(),
1219
visible: true,
1320
styles: {},
1421
keys: {}

symbols.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22

3-
const isHyper = process.env.TERM_PROGRAM === 'Hyper';
4-
const isWindows = process.platform === 'win32';
5-
const isLinux = process.platform === 'linux';
3+
const isHyper = typeof process !== 'undefined' && process.env.TERM_PROGRAM === 'Hyper';
4+
const isWindows = typeof process !== 'undefined' && process.platform === 'win32';
5+
const isLinux = typeof process !== 'undefined' && process.platform === 'linux';
66

77
const common = {
88
ballotDisabled: '☒',

0 commit comments

Comments
 (0)