I have an array that looks something like this
settings: [
{ key: 'maxImageSize', value: '512' },
{ key: 'maxFileSize', value: '2048' },
{ key: 'searchResultsLimit', value: '10' },
]
I would like to validate the value of each key before saving them to a database.
Example: searchResultsLimit
should be greater than 1 but never exceed 20.
I am using Objection.js
and express-validator
.
Thanks.