badmfck-api-server 4.0.2 → 4.0.3
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.
|
@@ -270,6 +270,13 @@ class Validator {
|
|
|
270
270
|
if (object[i] > structureOptions.max)
|
|
271
271
|
errors.push("value for field '" + parentPath + i + "' is too big, expected less than " + structureOptions.max + " got: " + object[i]);
|
|
272
272
|
}
|
|
273
|
+
if (typeof structure[i] === "string" && !structureOptions.optional) {
|
|
274
|
+
let min = structureOptions.min || 1;
|
|
275
|
+
if (isNaN(min) || min < 1)
|
|
276
|
+
min = 1;
|
|
277
|
+
if (object[i].toString().trim().length < min)
|
|
278
|
+
errors.push("empty value for field '" + parentPath + i + "'");
|
|
279
|
+
}
|
|
273
280
|
if (typeof object[i] === "string" && structureOptions.min && !isNaN(structureOptions.min)) {
|
|
274
281
|
if (object[i].length < structureOptions.min)
|
|
275
282
|
errors.push("value length for field '" + parentPath + i + "' is too small, expected more than " + structureOptions.min + " got: " + object[i].length);
|