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

is NotOnlySpecial.js Validator Added

Open Akshat-Mishra101 opened this issue 3 years ago • 2 comments

isNotOnlySpecial checks whether the input string is not made up only of special characters.

Checklist

  • [x] PR contains only changes related; no stray files, etc.
  • [x] README updated (where applicable)
  • [x] Tests written (where applicable)

Akshat-Mishra101 avatar Aug 09 '22 13:08 Akshat-Mishra101

Codecov Report

Merging #2022 (093ccfd) into master (86a07ba) will not change coverage. The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master     #2022   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          104       105    +1     
  Lines         2203      2210    +7     
  Branches       477       478    +1     
=========================================
+ Hits          2203      2210    +7     
Impacted Files Coverage Δ
src/index.js 100.00% <100.00%> (ø)
src/lib/isNotOnlySpecial.js 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Aug 09 '22 14:08 codecov[bot]

Hey guys, I've added a new validator to this library. I'm still new to open-source, and this is my first real contribution, hope it passes through :)

Akshat-Mishra101 avatar Aug 09 '22 15:08 Akshat-Mishra101

Welcome to open source! 🎉 Thank you for your contribution!

Could you provide an example use case for this validator? It seems quite specific and may not be generally useful enough to be its own validator (since you can just use the regex in a regex validator to achieve the same thing).

Hey braaar, thankyou for the quick response. I was thinking of having some sort of password validation for my apps, where I thought this could be useful.

But along the way, I had an idea for an even better password validation system, where you can define the minimum, maximum length, the least amount of letters (upper and lowercase), (valid) characters and numbers, along with some default settings.

Should i start with implementing that instead :)

Akshat-Mishra101 avatar Aug 10 '22 04:08 Akshat-Mishra101

But along the way, I had an idea for an even better password validation system, where you can define the minimum, maximum length, the least amount of letters (upper and lowercase), (valid) characters and numbers, along with some default settings.

Should i start with implementing that instead :)

isStrongPassword has you covered :)

isStrongPassword(str [, options])
Check if a password is strong or not. Allows for custom requirements or scoring rules. If returnScore is true, then the function returns an integer score for the password rather than a boolean.
Default options:
{ minLength: 8, minLowercase: 1, minUppercase: 1, minNumbers: 1, minSymbols: 1, returnScore: false, pointsPerUnique: 1, pointsPerRepeat: 0.5, pointsForContainingLower: 10, pointsForContainingUpper: 10, pointsForContainingNumber: 10, pointsForContainingSymbol: 10 }

braaar avatar Aug 10 '22 07:08 braaar

But along the way, I had an idea for an even better password validation system, where you can define the minimum, maximum length, the least amount of letters (upper and lowercase), (valid) characters and numbers, along with some default settings. Should i start with implementing that instead :)

isStrongPassword has you covered :)

isStrongPassword(str [, options]) Check if a password is strong or not. Allows for custom requirements or scoring rules. If returnScore is true, then the function returns an integer score for the password rather than a boolean.Default options: { minLength: 8, minLowercase: 1, minUppercase: 1, minNumbers: 1, minSymbols: 1, returnScore: false, pointsPerUnique: 1, pointsPerRepeat: 0.5, pointsForContainingLower: 10, pointsForContainingUpper: 10, pointsForContainingNumber: 10, pointsForContainingSymbol: 10 }

Thanks braaar, I'll close this pull request now. Just want to ask one last thing, can i introduce a validator for the adhaar card, which is famous identification method in the indian region. :)

Akshat-Mishra101 avatar Aug 10 '22 10:08 Akshat-Mishra101

Is that the same as the Indian identity card we already have as part of isIdentityCard? Or is this adhaar a different one? In the latter case it might be good to make an issue for it so we can discuss if it should be part of an existing validator or justifies a new isAdhaar

WikiRik avatar Aug 10 '22 11:08 WikiRik

I'm not sure as according to UIDAI, an adhaar cannot start with 0 or 1. The isIdentityCard validator for the indian locale tests true for all card numbers starting with 0.

Here are the rules for adhar

Akshat-Mishra101 avatar Aug 10 '22 11:08 Akshat-Mishra101