async-validate
Advanced tools
Comparing version 0.4.14 to 0.4.15
@@ -229,3 +229,3 @@ ## Guide | ||
* `object`: Must be of type `object` and not `Array.isArray`. | ||
* `enum`: Value must exist in the `enum`. | ||
* `enum`: Value must exist in the `list`. | ||
* `date`: Value must be valid as determined by `moment().isValid()`. | ||
@@ -275,7 +275,7 @@ | ||
To validate a value from a list of possible values use the `enum` type with a `enum` property listing the valid values for the field, for example: | ||
To validate a value from a list of possible values use the `enum` type with a `list` property containing the valid values for the field, for example: | ||
```javascript | ||
var descriptor = { | ||
role: {type: "enum", enum: ['admin', 'user', 'guest']} | ||
role: {type: "enum", list: ['admin', 'user', 'guest']} | ||
} | ||
@@ -313,2 +313,1 @@ ``` | ||
You may wish to sanitize user input instead of testing for whitespace, see [transform](#transform) for an example that would allow you to strip whitespace. | ||
{ | ||
"name": "async-validate", | ||
"description": "Asynchronous validation for object properties.", | ||
"version": "0.4.14", | ||
"version": "0.4.15", | ||
"author": "muji <noop@xpm.io>", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -9,3 +9,3 @@ /** | ||
this.required(); | ||
var list = this.rule.enum; | ||
var list = this.rule.list; | ||
if(list.indexOf(this.value) === -1) { | ||
@@ -12,0 +12,0 @@ this.raise( |
@@ -321,3 +321,3 @@ Table of Contents | ||
* `object`: Must be of type `object` and not `Array.isArray`. | ||
* `enum`: Value must exist in the `enum`. | ||
* `enum`: Value must exist in the `list`. | ||
* `date`: Value must be valid as determined by `moment().isValid()`. | ||
@@ -367,7 +367,7 @@ | ||
To validate a value from a list of possible values use the `enum` type with a `enum` property listing the valid values for the field, for example: | ||
To validate a value from a list of possible values use the `enum` type with a `list` property containing the valid values for the field, for example: | ||
```javascript | ||
var descriptor = { | ||
role: {type: "enum", enum: ['admin', 'user', 'guest']} | ||
role: {type: "enum", list: ['admin', 'user', 'guest']} | ||
} | ||
@@ -374,0 +374,0 @@ ``` |
@@ -8,3 +8,3 @@ var util = require('util'); | ||
var descriptor = { | ||
role: {type: "enum", enum: ['admin', 'user', 'guest']} | ||
role: {type: "enum", list: ['admin', 'user', 'guest']} | ||
} | ||
@@ -20,3 +20,3 @@ var validator = new schema(descriptor); | ||
var descriptor = { | ||
role: {type: "enum", enum: ['admin', 'user', 'guest']} | ||
role: {type: "enum", list: ['admin', 'user', 'guest']} | ||
} | ||
@@ -23,0 +23,0 @@ var validator = new schema(descriptor); |
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
128135