(env?: string)
| 1 | export 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 | }; |
no outgoing calls
no test coverage detected