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

Function normalizeOptions

packages/react/src/FormKitProvider.ts:33–54  ·  view source on GitHub ↗
(
  config?: FormKitOptions | ((...args: any[]) => FormKitOptions)
)

Source from the content-addressed store, hash-verified

31}
32
33function normalizeOptions(
34 config?: FormKitOptions | ((...args: any[]) => FormKitOptions)
35): FormKitOptions {
36 const resolvedConfig =
37 typeof config === 'function' ? config() : config
38
39 if (resolvedConfig?.config?.rootConfig) {
40 return resolvedConfig
41 }
42
43 const options = Object.assign(
44 {
45 alias: 'FormKit',
46 schemaAlias: 'FormKitSchema',
47 },
48 resolvedConfig
49 )
50
51 const rootConfig = createConfig(options.config || {})
52 options.config = { rootConfig }
53 return options
54}
55
56/**
57 * Creates and returns normalized FormKit options + rootConfig.

Callers 1

useConfigFunction · 0.70

Calls 2

createConfigFunction · 0.90
configFunction · 0.85

Tested by

no test coverage detected