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

Function getTailValue

packages/core/src/compiler.ts:65–81  ·  view source on GitHub ↗
(obj: any, addr: string)

Source from the content-addressed store, hash-verified

63}
64
65function getTailValue(obj: any, addr: string): unknown {
66 if (!obj || typeof obj !== 'object') return null
67 const segments = addr.split('.')
68 let current = obj
69 for (const i in segments) {
70 const segment = segments[i]
71 // Use `in` so prototype members (class getters/methods) still resolve.
72 if (!(segment in current)) return undefined
73 const value = current[segment]
74 if (+i === segments.length - 1) {
75 return typeof value === 'function' ? value.bind(current) : value
76 }
77 if (!value || typeof value !== 'object') return undefined
78 current = value
79 }
80 return undefined
81}
82
83/**
84 * Describes a registry of operators that occur at different periods during

Callers 1

evaluateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected