pyvalid icon indicating copy to clipboard operation
pyvalid copied to clipboard

Chainable validators shorthands

Open eterey opened this issue 5 years ago • 0 comments

Create chainable shorthands for pyvalid's validators. It may be useful for cases, when we just need to quickly verify some value without preparing comprehensive validators.

Examples:

from pyvalid import check

check('Some_Str0ng_P@ssword!').all().min_length(6).max_length(64).contains_special_symbols(2).contains_numbers(1).exec()
# Returns `True`

check('WeakPass').all().min_length(6).max_length(64).contains_special_symbols(2).contains_numbers(1).exec()
# Returns `False`

check('12345').is_postal_code('gb').exec()
# Returns `False`

check('SW1W 0NY').is_postal_code('gb').exec()
# Returns `True`

The naming and style can be changed thought.

eterey avatar Nov 08 '20 21:11 eterey