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

Function extendSchema

packages/inputs/src/createSection.ts:186–198  ·  view source on GitHub ↗
(
  schema: FormKitSchemaNode,
  extension: FormKitSchemaNodeExtension | FormKitSchemaCondition | null = {}
)

Source from the content-addressed store, hash-verified

184 */
185/*@__NO_SIDE_EFFECTS__*/
186export function extendSchema(
187 schema: FormKitSchemaNode,
188 extension: FormKitSchemaNodeExtension | FormKitSchemaCondition | null = {}
189): FormKitSchemaNode {
190 if (typeof schema === 'string') {
191 return isSchemaObject(extension) || typeof extension === 'string'
192 ? extension
193 : schema
194 } else if (Array.isArray(schema)) {
195 return isSchemaObject(extension) ? extension : schema
196 }
197 return extend(schema, extension) as FormKitSchemaNode
198}

Callers 2

extendableFunction · 0.90
extendableFunction · 0.85

Calls 2

extendFunction · 0.90
isSchemaObjectFunction · 0.85

Tested by

no test coverage detected