( config?: FormKitOptions | ((...args: any[]) => FormKitOptions) )
| 31 | } |
| 32 | |
| 33 | function 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. |
no test coverage detected