Skip to content

Commit 0ec9599

Browse files
authored
Destructure process into constants (#93)
1 parent e83603a commit 0ec9599

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import * as tty from "tty"
22

3-
const proc = typeof process === "undefined" ? {} : process
4-
5-
const env = proc.env || {}
6-
const argv = proc.argv || []
3+
const { env, argv, platform } = typeof process === "undefined" ? {} : process
74

85
const isDisabled = "NO_COLOR" in env || argv.includes("--no-color")
96
const isForced = "FORCE_COLOR" in env || argv.includes("--color")
10-
const isWindows = proc.platform === "win32"
7+
const isWindows = platform === "win32"
118
const isDumbTerminal = env.TERM === "dumb"
129

1310
const isCompatibleTerminal =
@@ -18,7 +15,8 @@ const isCI =
1815
("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env)
1916

2017
export const isColorSupported =
21-
!isDisabled && (isForced || (isWindows && !isDumbTerminal) || isCompatibleTerminal || isCI)
18+
!isDisabled &&
19+
(isForced || (isWindows && !isDumbTerminal) || isCompatibleTerminal || isCI)
2220

2321
const replaceClose = (
2422
index,

0 commit comments

Comments
 (0)