New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-input-validator

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-input-validator - npm Package Compare versions

Comparing version
1.1.6
to
1.2.0
+1
-1
package.json
{
"name": "react-input-validator",
"version": "1.1.6",
"version": "1.2.0",
"description": "react-input-validator is input super class validator",

@@ -5,0 +5,0 @@ "main": "Client/src/InputValidator/InputValidator.es5.js",

@@ -38,3 +38,42 @@

# Live Example (See Examples folder for more implementations examples)
<img src="https://cdn.rawgit.com/Attrash-Islam/react-input-validator/master/Images/Examples.gif" />
# Example (See Examples folder for more implementations examples)
```
import InputValidator from 'react-input-validator';
class PhoneInput extends InputValidator {
constructor(props) {
super(props);
}
render() {
return (
<div className={'relative-pos form-group' + super.getValidationClass()}>
<label htmlFor="phone-input">Phone Number:</label>
<input type="text"
ref={node => this.phoneRef = node}
onChange={() => { super.onInputChange(this.phoneRef, this.validatePhone) }}
className="form-control" id="phone-input" />
<i className="hidden fa fa-spin fa-spinner"></i>
</div>
)
}
validatePhone() {
//Pattern: xxx-xxxxxxx || xxxxxxxxxx
let phoneRegex = /^[0-9][0-9][0-9](-?)[0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/;
if(phoneRegex.test(this.phoneRef.value)) {
return true;
} else if (!phoneRegex.test(this.phoneRef.value)) {
return false;
}
}
}
export default PhoneInput;
```

Sorry, the diff of this file is not supported yet