Skip to content

Commit

Permalink
ensure process is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
jonschlinkert committed May 16, 2022
1 parent 64189b1 commit 6894dbd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ const isObject = val => val !== null && typeof val === 'object' && !Array.isArra
// this is a modified version of https://github.com/chalk/ansi-regex (MIT License)
const ANSI_REGEX = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g;

const hasColor = () => {
if (typeof process !== 'undefined') {
return process.env.FORCE_COLOR !== '0';
}
return false;
};

const create = () => {
const colors = {
enabled: process.env.FORCE_COLOR !== '0',
enabled: hasColor(),
visible: true,
styles: {},
keys: {}
Expand Down
6 changes: 3 additions & 3 deletions symbols.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

const isHyper = process.env.TERM_PROGRAM === 'Hyper';
const isWindows = process.platform === 'win32';
const isLinux = process.platform === 'linux';
const isHyper = typeof process !== 'undefined' && process.env.TERM_PROGRAM === 'Hyper';
const isWindows = typeof process !== 'undefined' && process.platform === 'win32';
const isLinux = typeof process !== 'undefined' && process.platform === 'linux';

const common = {
ballotDisabled: '☒',
Expand Down

0 comments on commit 6894dbd

Please sign in to comment.