regexbuddy
Advanced tools
Comparing version 0.4.30 to 0.5.30
{ | ||
"name": "regexbuddy", | ||
"version": "0.4.30", | ||
"version": "0.5.30", | ||
"description": "Implement regex expressions in JavaScript", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -45,9 +45,9 @@ # RegexBuddy | ||
Default requirements are that a password must contain: | ||
Default requirements are that a password must contain (with the option name and data type for overwriting defaults): | ||
1. At least one uppercase letter | ||
2. At least one lowercase letter | ||
3. At least one number | ||
4. At least one special character | ||
5. A minimum of 5 characters | ||
1. At least one uppercase letter (name: requireUpperCase, type: boolean) | ||
2. At least one lowercase letter (name: requireLowerCase, type: boolean) | ||
3. At least one number (name: requireNumber, type: boolean) | ||
4. At least one special character (name: requireSpecialCharacter, type: boolean) | ||
5. A minimum of 5 characters (name: minLength, type: number) | ||
@@ -57,5 +57,27 @@ The default requirements can be overwritten by passing in your requirements in the validate function like this: | ||
```javascript | ||
regexBuddy.password(input).validate({ minlength: 8, requireNumber: false }); | ||
regexBuddy.password(input).validate({ minlength: 8, requireSpecialCharacter: false }); | ||
``` | ||
**NOTE:** Options that are ignored will still have their default values used. So in the example above, a password must have at least 8 characters and does not need to have a number. But it must also still include an uppercase letter, lowercase letter, and a special character. | ||
**NOTE:** Options that are ignored will still have their default values used. So in the example above, a password must have at least 8 characters and does not need to have a number. But it must also still include an uppercase letter, lowercase letter, and a special character. | ||
An example of how to use this in your code would be: | ||
```javascript | ||
const validPassword = regexBuddy.password(input).validate({ minlength: 8, requireSpecialCharacter: false }); | ||
``` | ||
This would let you reference the `validPassword` variable in a simple way, like this conditional statement: | ||
```javascript | ||
// If a password is valid | ||
if (validPassword) { | ||
// Run this code | ||
... | ||
} | ||
``` | ||
Or implement in your corresponding template file, like this: | ||
```html | ||
<button type="submit" disabled={!validPassword}>Submit</button> | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7592
81