Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

regexbuddy

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

regexbuddy - npm Package Compare versions

Comparing version 0.9.5 to 0.9.6

2

package.json
{
"name": "regexbuddy",
"version": "0.9.5",
"version": "0.9.6",
"description": "Implement regex expressions in JavaScript",

@@ -5,0 +5,0 @@ "repository": {

@@ -35,4 +35,2 @@ # RegexBuddy

**NOTE:** The password validation method simply returns `true` or `false`.
For password validation, you can simply use:

@@ -57,3 +55,3 @@

```javascript
regexBuddy.password(input).validate({ minlength: 8, requireSpecialCharacter: false });
regexBuddy.password(input).validate({ minLength: 8, requireSpecialCharacter: false });
```

@@ -63,14 +61,25 @@

**NOTE:** The password validation method returns an object structured like this:
```javascript
{
valid: boolean,
errors: [ validationErrors ] || null
}
```
This gives you the option of serving the client an array of the criteria not met when creating a password, or simply using the password validation method in a conditional expression. And the `valid` property was added for those who prefer using explicit conditional evaluation over implicit "truthy" methods for something like a password.
An example of how to use this in your code would be:
```javascript
const validPassword = regexBuddy.password(input).validate({ minlength: 8, requireSpecialCharacter: false });
const passwordCheck = regexBuddy.password(input).validate({ minlength: 8, requireSpecialCharacter: false });
```
This would let you reference the `validPassword` variable in a simple way, like this conditional statement:
This would let you reference the `passwordCheck` variable in a simple way, like these examples:
```javascript
// If a password is valid
if (validPassword) {
// Run this code
// If a password is invalid
if (passwordCheck.errors) {
// You can then map the array of errors in passwordCheck.errors to a DOM object, like a toast, modal, etc.
...

@@ -80,6 +89,6 @@ }

Or implement in your corresponding template file, like this:
Or implement as a simple, explicit conditional in your corresponding template file, like this example, where a submit button is disabled when there are any errors with the user's input value:
```html
<button type="submit" disabled={!validPassword}>Submit</button>
<button type="submit" disabled={!passwordCheck.valid}>Submit</button>
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc