Skip to content

Commit

Permalink
fix: loadENV return
Browse files Browse the repository at this point in the history
  • Loading branch information
iugo committed Jan 21, 2022
1 parent a76cad9 commit 6ffecc2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ export async function readBody(reqBody?: Deno.Reader) {
* [Deno] Load Environment Variables
* @param path environment file
*/
export function loadENV(path = './.env'): [Error | null, Record<string, string>] {
export function loadENV(
path = './.env',
): [Error | null, Record<string, string>] {
let error: Error | null = null;
let res: Record<string, string> = {};
const res: Record<string, string> = {};
try {
Deno.readTextFileSync(path)
.split('\n')
Expand All @@ -39,7 +41,7 @@ export function loadENV(path = './.env'): [Error | null, Record<string, string>]
} catch (err) {
error = err;
}
return [Error | null, res];
return [error, res];
}

/**
Expand Down

0 comments on commit 6ffecc2

Please sign in to comment.