diff options
Diffstat (limited to 'u/process/env.ts')
-rw-r--r-- | u/process/env.ts | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/u/process/env.ts b/u/process/env.ts index c0d893c..470cb39 100644 --- a/u/process/env.ts +++ b/u/process/env.ts @@ -1,11 +1,10 @@ import { Either, type IEither } from "@emprespresso/pengueno"; export const getRequiredEnv = <V extends string>(name: V): IEither<Error, V> => - Either.fromFailable<Error, V>(() => Deno.env.get(name) as V) // could throw when no permission. + Either.fromFailable<Error, V | undefined>(() => Deno.env.get(name) as V | undefined) // could throw when no permission. .flatMap( - (v) => - (v && Either.right(v)) || - Either.left(new Error(`environment variable "${name}" is required D:`)), + (v) => (v && Either.right(v)) || + Either.left(new Error(`environment variable "${name}" is required D:`)) ); type ObjectFromList<T extends ReadonlyArray<string>, V = string> = { |