MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / stripEnvQuotes

Function stripEnvQuotes

dev/local/env-sync/parse.ts:58–68  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

56// Env file parsing
57// ---------------------------------------------------------------------------
58
59function stripEnvQuotes(value: string): string {
60 if (value.startsWith('"') && value.endsWith('"')) {
61 return value
62 .slice(1, -1)
63 .replace(/\\(["\\n])/g, (_match, ch: string) => (ch === 'n' ? '\n' : ch));
64 }
65 if (value.startsWith("'") && value.endsWith("'")) {
66 return value.slice(1, -1);
67 }
68 // An unquoted value follows dotenv semantics, which nextjs applies when it
69 // reads the same .env.local: a trailing ` # comment` is not part of the
70 // value (the e2e stub tags its env line with one).
71 return value.replace(/\s+#.*$/, '').trim();

Callers 2

parseEnvFileFunction · 0.70
parseExampleFileFunction · 0.70

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected