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

Function set

packages/core/src/node.ts:2989–3013  ·  view source on GitHub ↗
(...args)

Source from the content-addressed store, hash-verified

2987 return defaultConfig[prop as string]
2988 },
2989 set(...args) {
2990 const prop = args[1] as string
2991 const value = args[2]
2992 if (prop === '_n') {
2993 node = value as FormKitNode
2994 if (target.rootConfig) target.rootConfig._add(node)
2995 return true
2996 }
2997 if (prop === '_rmn') {
2998 if (target.rootConfig) target.rootConfig._rm(node as FormKitNode)
2999 node = undefined
3000 return true
3001 }
3002 if (!eq(target[prop as string], value, false)) {
3003 const didSet = Reflect.set(...args)
3004 if (node) {
3005 node.emit(`config:${prop}`, value, false)
3006 configChange(node, prop, value)
3007 // Walk the node tree and notify of config/prop changes where relevant
3008 node.walk((n) => configChange(n, prop, value), false, true)
3009 }
3010 return didSet
3011 }
3012 return true
3013 },
3014 }) as FormKitConfig
3015}
3016

Callers

nothing calls this directly

Calls 3

eqFunction · 0.90
configChangeFunction · 0.90
toPropsObjFunction · 0.85

Tested by

no test coverage detected