isvalid 4.0.10 → 4.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
- [`Array` Validators](#array-validators)
|
|
34
34
|
* [`len`](#len)
|
|
35
35
|
* [`unique`](#unique)
|
|
36
|
-
* [`
|
|
36
|
+
* [`autoWrap`](#autowrap)
|
|
37
37
|
- [`String` Validators](#string-validators)
|
|
38
38
|
* [`trim`](#trim)
|
|
39
39
|
* [`len`](#len-1)
|
|
@@ -100,7 +100,7 @@ try {
|
|
|
100
100
|
'user': { type: String, required: true },
|
|
101
101
|
'pass': { type: String, required: true }
|
|
102
102
|
});
|
|
103
|
-
|
|
103
|
+
|
|
104
104
|
} catch(err) {
|
|
105
105
|
// A validation error occurred.
|
|
106
106
|
}
|
|
@@ -474,7 +474,7 @@ Example:
|
|
|
474
474
|
|
|
475
475
|
> The `unique` validator does a deep comparison on objects and arrays.
|
|
476
476
|
|
|
477
|
-
##### `
|
|
477
|
+
##### `autoWrap`
|
|
478
478
|
Type: `Boolean`
|
|
479
479
|
|
|
480
480
|
If the provided data is not an array - but it matches the sub-schema - this will wrap the data in an array before actual validation.
|
|
@@ -484,12 +484,12 @@ Example:
|
|
|
484
484
|
````javascript
|
|
485
485
|
{
|
|
486
486
|
type: Array,
|
|
487
|
-
|
|
487
|
+
autoWrap: true,
|
|
488
488
|
schema: { … }
|
|
489
489
|
}
|
|
490
490
|
````
|
|
491
491
|
|
|
492
|
-
If `
|
|
492
|
+
If `autoWrap` is set to `true` and auto-wrap fails (the sub-schema cannot validate the data), then the `type` validator will emit a `'Must be of type Array.'` error.
|
|
493
493
|
|
|
494
494
|
> Default is `false`.
|
|
495
495
|
|