We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bdca5bd commit 4dde533Copy full SHA for 4dde533
lib/validators/length.js
@@ -3,6 +3,7 @@
3
*
4
* {
5
* length: {
6
+ * eq: Number, // Exact allowed value
7
* max: Number, // Maximum allowed value
8
* min: Number // Minimum allowed value
9
* }
@@ -14,6 +15,11 @@ function isValid(data, model) {
14
15
return true;
16
}
17
18
+ // Data hasn't the exact eq lenght
19
+ if(model.length.eq && data.length !== model.length.eq) {
20
+ return false;
21
+ }
22
+
23
// Data is higher than max
24
if(model.length.max && data.length > model.length.max) {
25
return false;
0 commit comments