Skip to content

Conversation

@brybrophy
Copy link
Contributor

@brybrophy brybrophy commented May 25, 2021

This PR adds a loose option to the isBoolean validator. It defaults to false, and in that mode, nothing changes from the current behavior.

When set to true, the validator will also validate yes, no, and will validate boolean strings of any case. (eg: ['true', 'True', 'TRUE', 'tRuE'])

This PR satisfies the request in this issue. #1672

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)

@codecov
Copy link

codecov bot commented May 25, 2021

Codecov Report

Merging #1676 (99cfd90) into master (907bb07) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #1676   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          101       101           
  Lines         1854      1860    +6     
=========================================
+ Hits          1854      1860    +6     
Impacted Files Coverage Δ
src/lib/isBoolean.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 907bb07...99cfd90. Read the comment docs.

@brybrophy
Copy link
Contributor Author

Bump on this PR.

Copy link
Member

@profnandaa profnandaa left a comment

Choose a reason for hiding this comment

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

LGTM

@profnandaa profnandaa merged commit 044159d into validatorjs:master Jul 16, 2021
@brybrophy brybrophy deleted the brybrophy/add-loose-boolean-validation branch August 4, 2021 18:27
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.

4 participants