MCPcopy Create free account
hub / github.com/formkit/formkit / $for

Function $for

packages/inputs/src/compose.ts:356–370  ·  view source on GitHub ↗
(
  varName: string,
  inName: string,
  section: FormKitSchemaExtendableSection
)

Source from the content-addressed store, hash-verified

354 */
355/*@__NO_SIDE_EFFECTS__*/
356export function $for(
357 varName: string,
358 inName: string,
359 section: FormKitSchemaExtendableSection
360) {
361 return (extensions: FormKitSectionsSchema): FormKitSchemaNode => {
362 const node = section(extensions)
363 if (isSlotCondition(node)) {
364 Object.assign(node.else, { for: [varName, inName] })
365 } else if (isSchemaObject(node)) {
366 Object.assign(node, { for: [varName, inName] })
367 }
368 return node
369 }
370}
371
372/**
373 * Extends a schema node with a given set of extensions.

Callers 1

compose.spec.tsFile · 0.90

Calls 2

isSchemaObjectFunction · 0.90
isSlotConditionFunction · 0.85

Tested by

no test coverage detected