Skip to content

Commit b77acae

Browse files
fix: correct error message formatting in dotenv key validation and streamline line formatting logic
1 parent 44b3102 commit b77acae

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/lib/dotenv-parse.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ export function removeDotenvKey(content: string, key: string): string {
4343

4444
function formatDotenvLine(key: string, value: string): string {
4545
const needsQuotes =
46-
/[\s#"']/.test(value) ||
47-
(value.length > 0 && value !== value.trim());
46+
/[\s#"']/.test(value) || (value.length > 0 && value !== value.trim());
4847
const encoded = needsQuotes
4948
? `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`
5049
: value;
@@ -66,7 +65,7 @@ export function appendDotenvKey(
6665
return { ok: false, error: "Enter a variable name" };
6766
}
6867
if (k.includes("=")) {
69-
return { ok: false, error: "Key cannot contain \"=\"" };
68+
return { ok: false, error: 'Key cannot contain "="' };
7069
}
7170
if (k.startsWith("#")) {
7271
return { ok: false, error: "Key cannot start with #" };

0 commit comments

Comments
 (0)