validator.js
validator.js copied to clipboard
isExact feature along with its tests and readme changes
This solves #1937
Added a new feature called "isExact", this is related to "isLength", in "isLength" we provide a minimum and maximum value of the given string, in this new feature, we can provide the exact size or sizes we require our string to be.
I added a new file called "isExact" with this feature, also I added some tests and updated the readme
Checklist
- [x] PR contains only changes related; no stray files, etc.
- [x] README updated (where applicable)
- [x] Tests written (where applicable)
Why not make this an option in the isLength validator? So you can do isLength(string, {exact: [3,5,11] })
Why not make this an option in the isLength validator? So you can do
isLength(string, {exact: [3,5,11] })
Nice approach, I will work in that and commit my changes :)
Why not make this an option in the isLength validator? So you can do
isLength(string, {exact: [3,5,11] })
Hello, I did the changes inside the isLength function and removed the isExact file, this is how it works now the isLength function:
Any comments, or commentaries, I will be glad to answer.
Would it be possible that we also have isLength("hello", [5, 6])
to return true? Since I think you don't really need the min/max if you want to add the exact
Hello, I am interested in making a contribution towards resolving this issue @WikiRik. I need some guidance..
This feature has been implemented in #2019 but thanks for the offer!