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

Function valueAtResetAddress

packages/core/src/reset.ts:37–53  ·  view source on GitHub ↗
(
  value: unknown,
  address: Array<string | number>
)

Source from the content-addressed store, hash-verified

35const missingResetValue = Symbol('missingResetValue')
36
37function valueAtResetAddress(
38 value: unknown,
39 address: Array<string | number>
40): unknown | typeof missingResetValue {
41 let current = value
42 for (const segment of address) {
43 if (
44 current === null ||
45 typeof current !== 'object' ||
46 !(segment in current)
47 ) {
48 return missingResetValue
49 }
50 current = (current as Record<string | number, unknown>)[segment]
51 }
52 return current
53}
54
55/**
56 * Resets an input to its "initial" value. If the input is a group or list it

Callers 1

resetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected