js-textfield-validation
Advanced tools
Comparing version 1.0.8 to 1.0.9
12
index.js
@@ -183,2 +183,12 @@ export default class Validation { | ||
return isValid; | ||
} | ||
} | ||
/** Check whether the value contains alphanumberic only. */ | ||
export const validateAlphanumericOnly = value => { | ||
let isValid = false; | ||
const regExpTest = /^[a-z0-9]+$/i; | ||
if (regExpTest.test(value)) { | ||
isValid = true; | ||
} | ||
return isValid; | ||
}; |
{ | ||
"name": "js-textfield-validation", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "An npm Package to validate textfield value.", | ||
@@ -28,3 +28,5 @@ "main": "index.js", | ||
"price-validation", | ||
"ip address" | ||
"ip address", | ||
"alphanumeric", | ||
"alphanumeric-validation" | ||
], | ||
@@ -31,0 +33,0 @@ "author": "Lerh Hwee Lern", |
@@ -18,22 +18,23 @@ # Textfield Validation | ||
| Validation | Description | Input | Output | | ||
| --- | --- | --- | --- | | ||
|`alphanumericOnly` | To accept alphanumeric only. | `nil` | `string` | | ||
|`dollarValue` | To create a value with two decimal places. | `nil` | `string` | | ||
|`ipAddress` | To accept number and dot only. | `nil` | `string` | | ||
|`noSpace` | To remove all the spaces. | `nil` | `string` | | ||
|`numOnly` | To remove all the non integer. | `nil` | `string` | | ||
|`removeNum` | To remove all the number. | `nil` | `string` | | ||
|`removeLeadingZero` | To remove all the leading zero. | `nil` | `string` | | ||
|`singleSpace` | To accept single space between two characters only. | `nil` | `string` | | ||
|`truncate` | To truncate the value to a specifc length. | `integer` | `string` | | ||
|`wordOnly` | To remove all non alphabet. | `nil` | `string` | | ||
| Methods | Description | | ||
| --- | --- | | ||
|`alphanumericOnly()` | To accept alphanumeric only. | | ||
|`dollarValue()` | To create a value with two decimal places. | | ||
|`ipAddress()` | To accept number and dot only. | | ||
|`noSpace()` | To remove all the spaces. | | ||
|`numOnly()` | To remove all the non integer. | | ||
|`removeNum()` | To remove all the number. | | ||
|`removeLeadingZero()` | To remove all the leading zero. | | ||
|`singleSpace()` | To accept single space between two characters only. | | ||
|`truncate(length: integer)` | To truncate the value to a specifc length. | | ||
|`wordOnly()` | To remove all non alphabet. | | ||
### Available non-chainable validations | ||
| Validation | Description | Input | Output | Remark | | ||
| Methods | Description | Output | Remark | | ||
| --- | --- | --- | --- | --- | | ||
|`validateEmail` | To check whether value is a valid email format. | `nil` | `boolean` | | | ||
|`validateIPAddress` | To check whether value is a valid IP address. | `nil` | `boolean` | | | ||
|`validateNRIC` | To check whether value is an valid NRIC in Singapore. | `nil` | `boolean` | Based on http://www.samliew.com/icval/ | | ||
|`validateAlphanumericOnly(value: string)` | To check whether the value contains alphanumberic only. | `boolean` | | | ||
|`validateEmail(email: string)` | To check whether value is a valid email format. | `boolean` | | | ||
|`validateNRIC(nric: string)` | To check whether value is an valid NRIC in Singapore. | `boolean` | [Source](http://www.samliew.com/icval/) | | ||
|`validateIPAddress(address: string)` | To check whether value is a valid IP address. | `boolean` | | | ||
@@ -40,0 +41,0 @@ ## HOW TO USE |
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
19248
387
143