MCPcopy Create free account
hub / github.com/angular/angular / applyWhen

Function applyWhen

packages/forms/signals/src/api/structure.ts:353–362  ·  view source on GitHub ↗
(
  path: SchemaPath<TValue>,
  logic: LogicFn<TValue, boolean>,
  schema: NoInfer<SchemaOrSchemaFn<TValue>>,
)

Source from the content-addressed store, hash-verified

351 * @publicApi 22.0
352 */
353export function applyWhen<TValue>(
354 path: SchemaPath<TValue>,
355 logic: LogicFn<TValue, boolean>,
356 schema: NoInfer<SchemaOrSchemaFn<TValue>>,
357): void {
358 assertPathIsCurrent(path);
359
360 const pathNode = FieldPathNode.unwrapFieldPath(path);
361 pathNode.mergeIn(SchemaImpl.create(schema), {fn: logic, path});
362}
363
364/**
365 * Conditionally applies a predefined schema to a given `FieldPath`.

Callers 5

path.spec.tsFile · 0.85
resource.spec.tsFile · 0.85
when.spec.tsFile · 0.85
applyWhenValueFunction · 0.85

Calls 4

assertPathIsCurrentFunction · 0.90
unwrapFieldPathMethod · 0.80
createMethod · 0.65
mergeInMethod · 0.45

Tested by

no test coverage detected