-
-
Notifications
You must be signed in to change notification settings - Fork 2
Improvements and suggestions #4
-
Hello
I added a library to my project and encountered several inconveniences. I would like to offer a few ideas for discussion.
Why not switch to parameter destructuring? Instead of passing parameters in a specific order, you can pass them by value.
for example, instead of validateUsername('User999', 8, 20, customErrorMsg);
you can use validateUsername('User999', {minLength: 8, maxLength: 20, errorMsg: customErrorMsg});
validateEmail('joaoaoao@gmail.com.com', null, null, null, true);
-> validateEmail('joaoaoao@gmail.com.com', {validDomains:true});
Next, personal wishes, what was missing for full implementation in the project:
validateEmail
It is possible to set the minimum length
validateUsername
Inability to disable checks:
contains spaces, starts with a number and contains only numbers
How, for example, is this done in validatePassword
validatePassword
Registration forms often use password confirmation. The libraries lacked this feature, as well as the isEqual method in general.
What do you say?
Beta Was this translation helpful? Give feedback.
All reactions
-
🚀 1
Replies: 1 comment
-
Thanks for the suggestions, I will consider your comments in a future update
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1