(value, field, { min, max, itemMax })
| 201 | } |
| 202 | |
| 203 | function stringArray(value, field, { min, max, itemMax }) { |
| 204 | if (!Array.isArray(value) || value.length < min || value.length > max) { |
| 205 | throw new LoopValidationError(`${field} must contain between ${min} and ${max} items.`); |
| 206 | } |
| 207 | |
| 208 | return value.map((item, index) => requiredString(item, `${field}[${index}]`, itemMax)); |
| 209 | } |
| 210 | |
| 211 | function validateDate(value, field) { |
| 212 | if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) { |
no test coverage detected