MCPcopy Create free account
hub / github.com/vercel/vercel / getEnvPath

Function getEnvPath

packages/cli-exec/src/envpath.ts:38–53  ·  view source on GitHub ↗
(env: NodeJS.ProcessEnv = process.env)

Source from the content-addressed store, hash-verified

36 * Reads PATH from an environment object with Windows casing compatibility.
37 */
38export function getEnvPath(env: NodeJS.ProcessEnv = process.env): string {
39 if (process.platform !== 'win32') {
40 return env.PATH ?? '';
41 }
42
43 const pathKeys = Object.keys(env).filter(key => key.toLowerCase() === 'path');
44
45 for (let index = pathKeys.length - 1; index >= 0; index--) {
46 const value = env[pathKeys[index]];
47 if (value !== undefined) {
48 return value;
49 }
50 }
51
52 return '';
53}
54
55/**
56 * Writes PATH to an environment object with normalized Windows casing.

Callers 3

findVercelCliFunction · 0.90
execVercelCliFunction · 0.90

Calls 2

filterMethod · 0.80
keysMethod · 0.45

Tested by

no test coverage detected