MCPcopy
hub / github.com/toddbluhm/env-cmd / parseEnvString

Function parseEnvString

src/parse-env-file.ts:57–66  ·  view source on GitHub ↗
(envFileString: string)

Source from the content-addressed store, hash-verified

55 * Parse out all env vars from a given env file string and return an object
56 */
57export function parseEnvString(envFileString: string): Environment {
58 // First thing we do is stripe out all comments
59 envFileString = stripComments(envFileString)
60
61 // Next we stripe out all the empty lines
62 envFileString = stripEmptyLines(envFileString)
63
64 // Merge the file env vars with the current process env vars (the file vars overwrite process vars)
65 return parseEnvVars(envFileString)
66}
67
68/**
69 * Parse out all env vars from an env file string

Callers 2

getEnvFileVarsFunction · 0.85

Calls 3

stripCommentsFunction · 0.85
stripEmptyLinesFunction · 0.85
parseEnvVarsFunction · 0.85

Tested by

no test coverage detected