MCPcopy Index your code
hub / github.com/formkit/formkit / createNode

Function createNode

packages/core/src/node.ts:3420–3445  ·  view source on GitHub ↗
(
  options?: FormKitOptions
)

Source from the content-addressed store, hash-verified

3418 * @public
3419 */
3420export function createNode<V = unknown>(
3421 options?: FormKitOptions
3422): FormKitNode<V> {
3423 const ops = options || {}
3424 const context = createContext(ops) as FormKitContext
3425 // Note: The typing for the proxy object cannot be fully modeled, thus we are
3426 // force-typing to a FormKitNode. See:
3427 // https://github.com/microsoft/TypeScript/issues/28067
3428 const node = new Proxy(context, {
3429 get(...args) {
3430 const [, property] = args
3431 if (property === '__FKNode__') return true
3432 const trap = context.traps.get(property)
3433 if (trap && trap.get) return trap.get(node, context)
3434 return Reflect.get(...args)
3435 },
3436 set(...args) {
3437 const [, property, value] = args
3438 const trap = context.traps.get(property)
3439 if (trap && trap.set) return trap.set(node, context, property, value)
3440 return Reflect.set(...args)
3441 },
3442 }) as unknown as FormKitNode
3443
3444 return nodeInit(node, ops)
3445}

Callers 15

useInputFunction · 0.90
i18n.spec.tsFile · 0.90
events.spec.tsFile · 0.90
lists.spec.tsFile · 0.90
store.spec.tsFile · 0.90
ledger.spec.tsFile · 0.90
classes.spec.tsFile · 0.90
node.spec.tsFile · 0.90
registry.spec.tsFile · 0.90
handlers.spec.tsFile · 0.90
validation.spec.tsFile · 0.90

Calls 2

createContextFunction · 0.85
nodeInitFunction · 0.85

Tested by

no test coverage detected