calidation
Advanced tools
Comparing version 1.2.2 to 1.3.0
@@ -37,3 +37,6 @@ 'use strict'; | ||
isRegexMatch: _calidators.isRegexMatch, | ||
isWhitelisted: _calidators.isWhitelisted | ||
isWhitelisted: _calidators.isWhitelisted, | ||
isMinLength: _calidators.isMinLength, | ||
isMaxLength: _calidators.isMaxLength, | ||
isExactLength: _calidators.isExactLength | ||
}; | ||
@@ -40,0 +43,0 @@ |
{ | ||
"name": "calidation", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "A red hot validation library for React", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -5,3 +5,3 @@ # calidation | ||
[![Build Status](https://travis-ci.org/selbekk/calidation.svg?branch=master)](https://travis-ci.org/selbekk/calidation) [![codecov](https://codecov.io/gh/selbekk/calidation/branch/master/graph/badge.svg)](https://codecov.io/gh/selbekk/calidation) | ||
[![Build Status](https://travis-ci.org/selbekk/calidation.svg?branch=master)](https://travis-ci.org/selbekk/calidation) [![codecov](https://codecov.io/gh/selbekk/calidation/branch/master/graph/badge.svg)](https://codecov.io/gh/selbekk/calidation) [![npm version](https://badge.fury.io/js/calidators.svg)](https://badge.fury.io/js/calidators) | ||
@@ -17,2 +17,5 @@ ``` | ||
I have written [the best blog post](https://medium.com/@selbekk/introducing-calidation-7d9a79453f7) | ||
of all time about this. | ||
## How do you even? | ||
@@ -44,2 +47,6 @@ | ||
isRequired: 'Password is also required!', | ||
isMinLength: { | ||
message: 'Password must be 8 characters or longer', | ||
length: 8, | ||
}, | ||
}, | ||
@@ -191,3 +198,4 @@ }; | ||
calidation comes with a lot of validators built in. These should be enough for | ||
most common use-cases. | ||
most common use-cases. You'll find them all in the sister package | ||
[`calidators`](https://github.com/selbekk/calidators). | ||
@@ -299,2 +307,41 @@ #### `isRequired` | ||
#### `isMinLength` | ||
Validates that a field is at least a given number of characters long. | ||
```js | ||
someField: { | ||
isMinLength: { | ||
message: 'You need at least four characters', | ||
length: 4, | ||
}, | ||
}, | ||
``` | ||
#### `isMaxLength` | ||
Validates that a field is at most a given number of characters long. | ||
```js | ||
someField: { | ||
isMaxLength: { | ||
message: 'You can at most have four characters', | ||
length: 4, | ||
}, | ||
}, | ||
``` | ||
#### `isExactLength` | ||
Validates that a field is exactly a given number of characters long. | ||
```js | ||
someField: { | ||
isExactLength: { | ||
message: 'Norwegian postal codes are four digits long', | ||
length: 4, | ||
}, | ||
}, | ||
``` | ||
### Custom validators | ||
@@ -301,0 +348,0 @@ |
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
33332
388
370