* A cheap function that iterates over all plugins and stops once node.define * is called. * * @param node - A FormKitNode | FormKitNode * @param plugins - An array of FormKitPlugin | FormKitPlugin * * @internal
(node: FormKitNode, plugins: Set<FormKitPlugin>)
| 3245 | * @internal |
| 3246 | */ |
| 3247 | function findDefinition(node: FormKitNode, plugins: Set<FormKitPlugin>): void { |
| 3248 | // If the definition is already there, force call to define. |
| 3249 | if (node.props.definition) return node.define(node.props.definition) |
| 3250 | for (const plugin of plugins) { |
| 3251 | if (node.props.definition) return |
| 3252 | if (typeof plugin.library === 'function') { |
| 3253 | plugin.library(node) |
| 3254 | } |
| 3255 | } |
| 3256 | } |
| 3257 | |
| 3258 | /** |
| 3259 | * Create a new context object for our a FormKit node, given default information |