3 ms·
> My only nitpick is that the const isPasswordValid = ... should be just before its use (between the first two ifs). Wouldn’t that cause the regexes to be reco
by xigoi 2y ago
> My only nitpick is that the const isPasswordValid = ... should be just before its use (between the first two ifs).
Wouldn’t that cause the regexes to be recompiled every time you call the function?
- TrianguloY 2y agoI don't think so, if it does it will now too. In fact with my suggestion the regex checks will not run if the user is not valid (as it is now it will always run) const isUserValid = ... if(!isUserValid) ... const isPasswordValid = ... if(!isPasswordValid) ... Etc