({ pattern }: PatternArgs)
| 20 | } |
| 21 | |
| 22 | function parsePattern({ pattern }: PatternArgs): RegExp { |
| 23 | // Avoid RegExp like /true/ /false/ and /null/ without an explicit "true", "false" or "null" |
| 24 | if (typeof pattern === 'boolean' || pattern === null) { |
| 25 | throw new Error(BAD_PARAMETER); |
| 26 | } |
| 27 | return getRegExp(pattern); |
| 28 | } |
| 29 | |
| 30 | export const validator: FieldValidationFunctionSync = fieldValidatorArgs => { |
| 31 | if (!fieldValidatorArgs.customArgs) { |