* 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 )
| 710 | * @returns |
| 711 | */ |
| 712 | function 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. |