* Returns a custom validation message if applicable. * @param node - FormKit Node * @param validation - The validation rule being processed.
( node: FormKitNode, validation: FormKitValidation, i18nArgs: FormKitValidationI18NArgs )
| 480 | * @param validation - The validation rule being processed. |
| 481 | */ |
| 482 | function createCustomMessage( |
| 483 | node: FormKitNode, |
| 484 | validation: FormKitValidation, |
| 485 | i18nArgs: FormKitValidationI18NArgs |
| 486 | ): string | undefined { |
| 487 | const customMessage = |
| 488 | node.props.validationMessages && |
| 489 | has(node.props.validationMessages, validation.name) |
| 490 | ? node.props.validationMessages[validation.name] |
| 491 | : undefined |
| 492 | if (typeof customMessage === 'function') { |
| 493 | return customMessage(...i18nArgs) |
| 494 | } |
| 495 | return customMessage |
| 496 | } |
| 497 | |
| 498 | /** |
| 499 | * Creates the arguments passed to the i18n |
no test coverage detected