Skip to content

Commit

Permalink
Undo autoformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
colinhacks committed Aug 14, 2023
1 parent 91bb154 commit de65a8d
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions packages/playwright-core/src/utils/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,22 @@

export function getFromENV(name: string): string | undefined {
let value = process.env[name];
value =
value === undefined
? process.env[`npm_config_${name.toLowerCase()}`]
: value;
value =
value === undefined
? process.env[`npm_package_config_${name.toLowerCase()}`]
: value;
value = value === undefined ? process.env[`npm_config_${name.toLowerCase()}`] : value;
value = value === undefined ? process.env[`npm_package_config_${name.toLowerCase()}`] : value;
return value;
}

export function getAsBooleanFromENV(name: string): boolean {
const value = getFromENV(name);
return !!value && value !== "false" && value !== "0";
return !!value && value !== 'false' && value !== '0';
}

export function getPackageManager() {
const env = process.env.npm_config_user_agent || "";
if (env.includes("yarn")) return "yarn";
if (env.includes("pnpm")) return "pnpm";
if (env.includes("bun")) return "bun";
return "npm";
const env = process.env.npm_config_user_agent || '';
if (env.includes('yarn'))
return 'yarn';
if (env.includes('pnpm'))
return 'pnpm';
if (env.includes("bun")) return "bun";
return 'npm';
}

0 comments on commit de65a8d

Please sign in to comment.