Skip to content

Getenv: return empty string instead of <undefined>#188

Merged
syumai merged 1 commit into
syumai:mainfrom
b0ch3nski:avoid-undefined-env
Feb 15, 2026
Merged

Getenv: return empty string instead of <undefined>#188
syumai merged 1 commit into
syumai:mainfrom
b0ch3nski:avoid-undefined-env

Conversation

@b0ch3nski

Copy link
Copy Markdown
Contributor

What

Getenv should check if variable is defined before returning it's value as string.

Motivation

To figure our if the environment variable was set or not, user code needs to check if the string not equals <undefined>. This requires the user to know the internals of the library which we should avoid.

Signed-off-by: Piotr Bocheński <piotr@bochen.ski>

@syumai syumai left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! Thanks

@syumai syumai merged commit 7960d47 into syumai:main Feb 15, 2026
2 checks passed
@b0ch3nski b0ch3nski deleted the avoid-undefined-env branch February 15, 2026 12:29
@b0ch3nski b0ch3nski mentioned this pull request May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants