Custom Validator
Regexp
import jm from 'json-msg'
const schema = {
username: jm.str({ hasNumber: /[0-9]/ }),
}
Function
- value is the value of the data that you passed in
- function must return a boolean
import jm from 'json-msg'
const schema = {
username: jm.str({ hasNumber: (value) => /[0-9]/.test(value) }),
}