forked from validatorjs/validator.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
isLength() / isByteLength()
also accept an options object `{mi…
…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
- Loading branch information
1 parent
de56274
commit 07978ef
Showing
4 changed files
with
44 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters