Comparing version 0.0.6 to 0.0.7
@@ -25,8 +25,14 @@ "use strict"; | ||
for (const key of required) { | ||
if (isEmpty(result[key])) { | ||
throw ex_1.default.UnprocessableEntity(`Value ${key} cannot be empty`, { | ||
body, | ||
required | ||
}); | ||
if (arrays.includes(key)) { | ||
if (result[key].length > 0 && !result[key].some(isEmpty)) | ||
continue; | ||
} | ||
else { | ||
if (!isEmpty(result[key])) | ||
continue; | ||
} | ||
throw ex_1.default.UnprocessableEntity(`Value ${key} cannot be empty`, { | ||
body, | ||
required | ||
}); | ||
} | ||
@@ -81,4 +87,2 @@ for (const key of numbers) { | ||
return true; | ||
if (Array.isArray(value) && value.length < 1) | ||
return true; | ||
return false; | ||
@@ -85,0 +89,0 @@ } |
{ | ||
"name": "kequapp", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Versatile, non-intrusive, tiny webapp framework", | ||
@@ -5,0 +5,0 @@ "main": "dist/main.js", |
@@ -191,3 +191,3 @@ # Kequapp | ||
Note body normalization is ignored when `raw` or `skipNormalize` is used. | ||
Note body normalization is ignored with `raw` or `skipNormalize`. | ||
@@ -230,3 +230,2 @@ ```javascript | ||
| ---------- | -------------------------------------------- | | ||
| `skipNormalize` | Skips normalization. | | ||
| `arrays` | Value is returned as an array. | | ||
@@ -236,2 +235,3 @@ | `required` | Value is not `null`, `undefined`, or an empty string. | | ||
| `booleans` | Value or values are converted to booleans. | | ||
| `skipNormalize` | Skip normalization. | | ||
@@ -238,0 +238,0 @@ ### Cookies |
65851
1424