-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,47 @@ | ||
prove | ||
===== | ||
|
||
Validation sugar with is | ||
Validation sugar with is-it | ||
|
||
Installation | ||
------------ | ||
|
||
```bash | ||
npm install prove | ||
``` | ||
|
||
Usage | ||
----- | ||
|
||
```javascript | ||
var prove = require('prove') | ||
|
||
if (var errs = prove(5).is('integer greaterThan(0)').errors) { | ||
// not valid | ||
} | ||
``` | ||
|
||
prove can also be chained: | ||
|
||
```javascript | ||
prove('foo').is('string').isnt('integer').errors | ||
``` | ||
|
||
API | ||
--- | ||
|
||
### prove(value) | ||
|
||
Returns a chainable object with `is`, `isnt` and `errors`. | ||
|
||
### .is(conditions) | ||
|
||
Runs the listed conditions against the value provided in `prove`. | ||
|
||
### .isnt(conditions) | ||
|
||
Runs the conditions against the value provided in `prove` but negated. | ||
|
||
### .errors | ||
|
||
This property contains an array of invalid conditions, or `null`. |