Skip to content

Commit

Permalink
fix falsy value handling
Browse files Browse the repository at this point in the history
fixes #12
  • Loading branch information
lpgera committed Aug 16, 2023
1 parent 8634d45 commit a372f4e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/orThrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default <T>(readFunction: ReadFunction<T>, type: string) => {
return (key: string) => {
const value = readFunction(key)

if (!value) {
if (value == null || (type === 'string' && value === '')) {
throw new Error(`Couldn't read ${type} value from process.env.${key}`)
}

Expand Down

0 comments on commit a372f4e

Please sign in to comment.