MCPcopy Create free account
hub / github.com/codename-co/stack / parseDotEnv

Function parseDotEnv

packages/website/src/helpers/dotenv.ts:1–17  ·  view source on GitHub ↗
(env?: string)

Source from the content-addressed store, hash-verified

1export const parseDotEnv = (env?: string) => {
2 if (!env) return {};
3
4 const obj: Record<string, string> = {};
5 env
6 .split("\n")
7 .filter(Boolean)
8 .forEach((line) => {
9 line = line.trim();
10 const isComment = line.startsWith("#");
11 const [key, value] = line.split("=");
12 if (key && !isComment) {
13 obj[key] = value;
14 }
15 });
16 return obj;
17};

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected