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

Function fnHints

packages/validation/src/validation.ts:712–730  ·  view source on GitHub ↗

* Extracts hint properties from the validation rule function itself and applies * them if they are not already in the set of validation hints extracted from * strings. * @param existingHints - An existing set of hints already parsed * @param rule - The actual rule function, which can contain hin

(
  existingHints: Partial<FormKitValidationHints>,
  rule: FormKitValidationRule
)

Source from the content-addressed store, hash-verified

710 * @returns
711 */
712function fnHints(
713 existingHints: Partial<FormKitValidationHints>,
714 rule: FormKitValidationRule
715) {
716 if (!existingHints.name) {
717 existingHints.name = rule.ruleName || rule.name
718 }
719 return ['skipEmpty', 'force', 'debounce', 'blocking'].reduce(
720 (hints: Partial<FormKitValidationHints>, hint: string) => {
721 if (has(rule, hint) && !has(hints, hint)) {
722 Object.assign(hints, {
723 [hint]: rule[hint as keyof FormKitValidationHints],
724 })
725 }
726 return hints
727 },
728 existingHints
729 )
730}
731
732/**
733 * Extracts all validation messages from the given node and all its descendants.

Callers 1

parseRulesFunction · 0.85

Calls 1

hasFunction · 0.90

Tested by

no test coverage detected