MCPcopy Create free account
hub / github.com/formkit/formkit / createCustomMessage

Function createCustomMessage

packages/validation/src/validation.ts:482–496  ·  view source on GitHub ↗

* Returns a custom validation message if applicable. * @param node - FormKit Node * @param validation - The validation rule being processed.

(
  node: FormKitNode,
  validation: FormKitValidation,
  i18nArgs: FormKitValidationI18NArgs
)

Source from the content-addressed store, hash-verified

480 * @param validation - The validation rule being processed.
481 */
482function 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

Callers 1

createFailedMessageFunction · 0.85

Calls 1

hasFunction · 0.90

Tested by

no test coverage detected