From 65079be79a2041bd88a2e00f3de5d1f4beb27a6c Mon Sep 17 00:00:00 2001 From: Oleksii Raspopov Date: Wed, 16 Oct 2024 11:48:50 -0400 Subject: [PATCH] make nonempty testing easier since env variables always string|undefined --- picocolors.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/picocolors.js b/picocolors.js index d4e9036..2dc32be 100644 --- a/picocolors.js +++ b/picocolors.js @@ -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) =>