Merge pull request #6 from LaustAxelsen/patch-2
words, spaces and special letters.
This commit is contained in:
commit
dc6ac20285
12
README.md
12
README.md
|
|
@ -497,6 +497,18 @@ Returns true if string only contains numbers
|
|||
```
|
||||
Returns true if string is only letters
|
||||
|
||||
**isWords**
|
||||
```html
|
||||
<MyInputComponent name="foo" validations="isWords"/>
|
||||
```
|
||||
Returns true if string is only letters, including spaces and tabs
|
||||
|
||||
**isWordsSpecial**
|
||||
```html
|
||||
<MyInputComponent name="foo" validations="isWordsSpecial"/>
|
||||
```
|
||||
Returns true if string is only letters, including special letters (a-z,ú,ø,æ,å)
|
||||
|
||||
**isLength:min**, **isLength:min:max**
|
||||
```html
|
||||
<MyInputComponent name="foo" validations="isLength:8"/>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,12 @@ var validationRules = {
|
|||
'isAlpha': function (value) {
|
||||
return value.match(/^[a-zA-Z]+$/);
|
||||
},
|
||||
'isWords': function (value) {
|
||||
return value.match(/^[a-zA-Z\s]+$/);
|
||||
},
|
||||
'isWordsSpecial': function (value) {
|
||||
return value.match(/^[a-zA-Z\s\u00C0-\u017F]+$/);
|
||||
},
|
||||
isLength: function (value, min, max) {
|
||||
if (max !== undefined) {
|
||||
return value.length >= min && value.length <= max;
|
||||
|
|
|
|||
Loading…
Reference in New Issue