Skip to content

Commit

Permalink
make nonempty testing easier since env variables always string|undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyraspopov committed Oct 16, 2024
1 parent 3cfbed8 commit 65079be
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions picocolors.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
let p = process || {},
argv = p.argv || [],
env = p.env || {}
let ne = v => v != null && String(v).length > 0
let isColorSupported =
!(ne(env.NO_COLOR) || argv.includes("--no-color")) &&
(ne(env.FORCE_COLOR) ||
!(!!env.NO_COLOR || argv.includes("--no-color")) &&
(!!env.FORCE_COLOR ||
argv.includes("--color") ||
p.platform === "win32" ||
((p.stdout || {}).isTTY && env.TERM !== "dumb") ||
ne(env.CI))
!!env.CI)

let formatter =
(open, close, replace = open) =>
Expand Down

0 comments on commit 65079be

Please # to comment.