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

extending isBoolean w/ "True" #1672

Closed
mathcoll opened this issue May 15, 2021 · 4 comments
Closed

extending isBoolean w/ "True" #1672

mathcoll opened this issue May 15, 2021 · 4 comments

Comments

@mathcoll
Copy link

mathcoll commented May 15, 2021

Hello, what about extending the isBoolean function by allowing :

  • "True"/"False" as valid boolean
  • "yes"/"no" as valid boolean (can be discussed but could make sense)

return (['true', 'false', '1', '0'].indexOf(str) >= 0);

@fedeci
Copy link
Contributor

fedeci commented May 15, 2021

It does make sense only behind an option that should default to false IMHO.
Like isBoolean(str, { loose: true }).

@brybrophy
Copy link
Contributor

I opened this PR to add the loose option to isBoolean. #1676

@brybrophy
Copy link
Contributor

I believe this issue can be closed now that #1676 was merged.

@tux-tn
Copy link
Member

tux-tn commented Aug 5, 2021

Thank you @brybrophy

@tux-tn tux-tn closed this as completed Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants