Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: toBoolean convert util #40

Closed
wants to merge 1 commit into from
Closed

feat: toBoolean convert util #40

wants to merge 1 commit into from

Conversation

blasdfaa
Copy link

Description

Converts any value to a boolean value.

Linked Issues

N/A

Additional context

N/A

@antfu
Copy link
Owner

antfu commented Dec 12, 2023

I am not so sure about it. I think the usage is a bit unclear and you don't always want to convert false to false. Without that conversion, I think a Boolean(value) would already do the thing.

@blasdfaa
Copy link
Author

I am not so sure about it. I think the usage is a bit unclear and you don't always want to convert false to false. Without that conversion, I think a Boolean(value) would already do the thing.

Such a function could be useful when converting boolean strings. For example, query parameters (foo=true&bar=false)

@antfu
Copy link
Owner

antfu commented Dec 12, 2023

Yes, I knew. And also for env value parsing, I suppose. My point is that they are specific use cases. In general, most of the time, you don't want this convention. Even if you two, it's just a few line in the code base to create a local util. I think I am not confident to have it in this project. Thanks for bringing this up.

@antfu antfu closed this Dec 12, 2023
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.

None yet

2 participants