validator.js icon indicating copy to clipboard operation
validator.js copied to clipboard

isExact feature along with its tests and readme changes

Open Carlos-Gaxiola opened this issue 2 years ago • 4 comments

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)

carbon

Carlos-Gaxiola avatar Mar 10 '22 19:03 Carlos-Gaxiola

Why not make this an option in the isLength validator? So you can do isLength(string, {exact: [3,5,11] })

WikiRik avatar Mar 10 '22 19:03 WikiRik

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 :)

Carlos-Gaxiola avatar Mar 10 '22 20:03 Carlos-Gaxiola

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:

carbon (3)

Any comments, or commentaries, I will be glad to answer.

Carlos-Gaxiola avatar Mar 15 '22 18:03 Carlos-Gaxiola

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

WikiRik avatar Mar 21 '22 12:03 WikiRik

Hello, I am interested in making a contribution towards resolving this issue @WikiRik. I need some guidance..

chashamsarao avatar Oct 02 '22 10:10 chashamsarao

This feature has been implemented in #2019 but thanks for the offer!

WikiRik avatar Oct 02 '22 11:10 WikiRik