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

Function createValue

packages/core/src/node.ts:1852–1865  ·  view source on GitHub ↗
(options: FormKitOptions)

Source from the content-addressed store, hash-verified

1850 * @public
1851 */
1852export function createValue(options: FormKitOptions): unknown {
1853 if (options.type === 'group') {
1854 return init(
1855 options.value &&
1856 typeof options.value === 'object' &&
1857 !Array.isArray(options.value)
1858 ? options.value
1859 : {}
1860 )
1861 } else if (options.type === 'list') {
1862 return init(Array.isArray(options.value) ? options.value : [])
1863 }
1864 return options.value
1865}
1866/**
1867 * Sets the internal value of the node.
1868 *

Callers 2

defineFunction · 0.85
createContextFunction · 0.85

Calls 1

initFunction · 0.90

Tested by

no test coverage detected