Comparing version 1.0.9 to 1.0.10
{ | ||
"author": "Mark Engel <mark.c.engel@gmail.com> (http://engel.cx)", | ||
"author": "Mark Engel <mark@engel.io> (http://www.engel.io)", | ||
"name": "kommissar", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"main": "src/index", | ||
"dependencies": { | ||
"underscore": "1.3.3", | ||
"underscore": "1.4.2", | ||
"async": "0.1.22", | ||
@@ -9,0 +9,0 @@ "hashish": "0.0.4" |
@@ -29,3 +29,5 @@ Kommissar | ||
customRule = (objectToValidate, parameter0, ..., parameterN) | ||
```coffeescript | ||
customRule = (objectToValidate, parameter0, ..., parameterN) | ||
``` | ||
@@ -39,14 +41,16 @@ which should return a boolean value | ||
userRule = (check) | ||
# simple rule | ||
check('email').isEmail() | ||
# optional error messages are supported | ||
check('password', 'Your Password is too short.').len 8 | ||
# rule are chainable | ||
check('string').len(8,64).isAlpha() | ||
# check if a field is valid in dependency on another field | ||
# this rule makes sense if the user wants to edit its | ||
# profile and the rule has to check if *no other* user | ||
# has this email | ||
check.('email').isUnique().with('id') | ||
```coffeescript | ||
userRule = (check) | ||
# simple rule | ||
check('email').isEmail() | ||
# optional error messages are supported | ||
check('password', 'Your Password is too short.').len 8 | ||
# rule are chainable | ||
check('string').len(8,64).isAlpha() | ||
# check if a field is valid in dependency on another field | ||
# this rule makes sense if the user wants to edit its | ||
# profile and the rule has to check if *no other* user | ||
# has this email | ||
check.('email').isUnique().with('id') | ||
``` | ||
@@ -65,5 +69,7 @@ Rules should be stored in a single file that is made available to the | ||
app.post '/route', | ||
kommissar.middleware() userRule, | ||
updateModelWithNewDataMiddleware | ||
```coffeescript | ||
app.post '/route', | ||
kommissar.middleware() userRule, | ||
updateModelWithNewDataMiddleware | ||
``` | ||
@@ -76,3 +82,5 @@ | ||
kommissar.middleware = (validations, failureMiddleware, successMiddleware) | ||
```coffeescript | ||
kommissar.middleware = (validations, failureMiddleware, successMiddleware) | ||
``` | ||
@@ -98,4 +106,6 @@ `validations` are the available validations. | ||
form = $ '#form' | ||
kommissar.clientValidate form, validations, rule, callback | ||
```coffeescript | ||
form = $ '#form' | ||
kommissar.clientValidate form, validations, rule, callback | ||
``` | ||
@@ -102,0 +112,0 @@ Enables the form `#form` for the validation. |
Sorry, the diff of this file is not supported yet
22827
145
+ Addedunderscore@1.4.2(transitive)
- Removedunderscore@1.3.3(transitive)
Updatedunderscore@1.4.2