-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
is[Byte]Length() should accept {min, max} as options #474
Comments
franciscolourenco
changed the title
isLenght()/isByteLenght() should accept {min, max} as options
Jan 18, 2016
isLenght()
/ isByteLenght()
should accept {min: 0, max: 0}
as options.
franciscolourenco
changed the title
isLenght()/isByteLenght() should accept {min, max} as options
is[Byte]Lenght() should accept {min, max} as options
Jan 18, 2016
Agreed, I'd be happy to accept a PR to add this form, as long as backwards compatibility is maintained. |
Working on PR. |
franciscolourenco
changed the title
is[Byte]Lenght() should accept {min, max} as options
is[Byte]Length() should accept {min, max} as options
Jan 18, 2016
franciscolourenco
added a commit
to franciscolourenco/validator.js
that referenced
this issue
Jan 19, 2016
…n, max}` Usage: - `isLength(str, {min: 4, max: 6})`; - `isLength(str, {min: 4})`; - `isLength(str, {max: 10})`; Because: - More consitent with `isInt({min:0, max:0})` and `isFloat({min:0, max: 0})` - More consitent with `isCurrency(str, options)` - Avoids confusions like validatorjs#465 - Allows `isLength({max: 10})` - Backwards compatible. - Better readability: - `isLength(str, 4)` reads like `(str.length == 4)`, but actually is `(str.length >= 4)` - Before: `isLength(str, 4, 10)` what do 4 and 10 mean? - After: `isLength(str, {min: 4, max:10})` closes validatorjs#474
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Because:
isInt({min:0, max:0})
andisFloat({min:0, max: 0})
isCurrency(str, {options})
isLength(str, 4)
reads like(str.length == 4)
, but actually is(str.length >= 4)
isLength(str, 4, 10)
what do 4 and 10 mean?isLength(str, {min: 4, max:10})
Also (edit):
isLength({max: 10})
The text was updated successfully, but these errors were encountered: