MCPcopy
hub / github.com/angular/angular / applyWhen

Function applyWhen

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

Source from the content-addressed store, hash-verified

322 * @publicApi 22.0
323 */
324export function applyWhen<TValue>(
325 path: SchemaPath<TValue>,
326 logic: LogicFn<TValue, boolean>,
327 schema: NoInfer<SchemaOrSchemaFn<TValue>>,
328): void {
329 assertPathIsCurrent(path);
330
331 const pathNode = FieldPathNode.unwrapFieldPath(path);
332 pathNode.mergeIn(SchemaImpl.create(schema), {fn: logic, path});
333}
334
335/**
336 * 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…