镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

feat(isBoolean) Add loose option to isBoolean validator - #1676

Merged
profnandaa merged 2 commits into
validatorjs:masterfrom
brybrophy:brybrophy/add-loose-boolean-validation
Jul 16, 2021
Merged

profnandaa merged 2 commits into
validatorjs:masterfrom
brybrophy:brybrophy/add-loose-boolean-validation

Conversation

@brybrophy

@brybrophy brybrophy commented May 25, 2021 •

Copy link
Copy Markdown
Contributor

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

codecov Bot commented May 25, 2021

Copy link
Copy Markdown

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
Copy Markdown
Contributor Author

Bump on this PR.

@profnandaa profnandaa left a comment

Copy link
Copy Markdown
Member

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