diff --git a/dist/expand-envs.js b/dist/expand-envs.js index ccb4853..59346d2 100644 --- a/dist/expand-envs.js +++ b/dist/expand-envs.js @@ -6,6 +6,6 @@ export function expandEnvs(str, envs) { return str.replace(/(? { const varValue = envs[varName.slice(1)]; // const test = 42; - return varValue === undefined ? varName : varValue.toString(); + return varValue ?? varName; }); } diff --git a/dist/parse-env-file.js b/dist/parse-env-file.js index 81f6c3e..2a2b9a0 100644 --- a/dist/parse-env-file.js +++ b/dist/parse-env-file.js @@ -49,7 +49,7 @@ export async function getEnvFileVars(envFilePath) { */ export function parseEnvString(envFileString) { // First thing we do is stripe out all comments - envFileString = stripComments(envFileString.toString()); + envFileString = stripComments(envFileString); // Next we stripe out all the empty lines envFileString = stripEmptyLines(envFileString); // Merge the file env vars with the current process env vars (the file vars overwrite process vars) @@ -110,7 +110,7 @@ export function normalizeEnvObject(input, absolutePath) { const env = {}; for (const [key, value] of Object.entries(input)) { // we're intentionally stringifying the value here, to - // match what `child_process.spawn` does when loading + // match what `child_process.spawn` does when loading // env variables. // eslint-disable-next-line @typescript-eslint/restrict-template-expressions env[key] = `${value}`; diff --git a/src/expand-envs.ts b/src/expand-envs.ts index 47a56d5..60b66cf 100644 --- a/src/expand-envs.ts +++ b/src/expand-envs.ts @@ -8,6 +8,6 @@ export function expandEnvs(str: string, envs: Environment): string { return str.replace(/(? { const varValue = envs[varName.slice(1)] // const test = 42; - return varValue === undefined ? varName : varValue.toString() + return varValue ?? varName }) } diff --git a/src/parse-env-file.ts b/src/parse-env-file.ts index a646cf8..296c6ac 100644 --- a/src/parse-env-file.ts +++ b/src/parse-env-file.ts @@ -56,7 +56,7 @@ export async function getEnvFileVars(envFilePath: string): Promise */ export function parseEnvString(envFileString: string): Environment { // First thing we do is stripe out all comments - envFileString = stripComments(envFileString.toString()) + envFileString = stripComments(envFileString) // Next we stripe out all the empty lines envFileString = stripEmptyLines(envFileString) @@ -126,7 +126,7 @@ export function normalizeEnvObject(input: unknown, absolutePath: string): Enviro const env: Environment = {}; for (const [key, value] of Object.entries(input)) { // we're intentionally stringifying the value here, to - // match what `child_process.spawn` does when loading + // match what `child_process.spawn` does when loading // env variables. // eslint-disable-next-line @typescript-eslint/restrict-template-expressions env[key] = `${value}`