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

Function normalizeEnvObject

src/parse-env-file.ts:121–135  ·  view source on GitHub ↗
(input: unknown, absolutePath: string)

Source from the content-addressed store, hash-verified

119 * consistincy. See issue #125 for details.
120 */
121export function normalizeEnvObject(input: unknown, absolutePath: string): Environment {
122 if (typeof input !== 'object' || !input) {
123 throw new Error(`env-cmd cannot load “${absolutePath}” because it does not export an object.`)
124 }
125
126 const env: Environment = {};
127 for (const [key, value] of Object.entries(input)) {
128 // we're intentionally stringifying the value here, to
129 // match what `child_process.spawn` does when loading
130 // env variables.
131 // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
132 env[key] = `${value}`
133 }
134 return env
135}

Callers 1

getEnvFileVarsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected