CSenshi / Validator

Easy-to-use, Highly Configurable Python Data Validator. Inspired by Laravel Validator
https://pypi.org/project/validator/
MIT License
46 stars 23 forks source link

New Rule: Binary #92

Closed CSenshi closed 4 years ago

CSenshi commented 4 years ago

Rule Name: Binary

Rule Description: {A clear and concise description of new rule}

Rule Usage Example:

reqs = {"data" : "010101010010"}
rule = {"data" : "binary"}
validate(reqs, rule) # True

reqs = {"data" : "0b010101010010"}
rule = {"data" : "binary"}
validate(reqs, rule) # True

reqs = {"data" : "1231231"}
rule = {"data" : "binay"}
validate(reqs, rule) # False, It fails because only 0 and 1 occures in binary

Before contributing please review RULES.md (check for duplication), also check CONTRIBUTING.md for more details :100: