MCPcopy Create free account
hub / github.com/modem-dev/hunk / envWithPath

Function envWithPath

scripts/script-helpers.ts:25–37  ·  view source on GitHub ↗
(
  path: string,
  base: NodeJS.ProcessEnv = process.env,
)

Source from the content-addressed store, hash-verified

23 * attempt to scope PATH. We strip every case-variant first, then set PATH.
24 */
25export function envWithPath(
26 path: string,
27 base: NodeJS.ProcessEnv = process.env,
28): NodeJS.ProcessEnv {
29 const next: NodeJS.ProcessEnv = {};
30 for (const [key, value] of Object.entries(base)) {
31 if (key.toLowerCase() !== "path") {
32 next[key] = value;
33 }
34 }
35 next.PATH = path;
36 return next;
37}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected