MCPcopy
hub / github.com/angular/angular / validate

Function validate

packages/forms/signals/src/api/rules/validation/validate.ts:31–41  ·  view source on GitHub ↗
(
  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,
  logic: NoInfer<FieldValidator<TValue, TPathKind>>,
)

Source from the content-addressed store, hash-verified

29 * @publicApi 22.0
30 */
31export function validate<TValue, TPathKind extends PathKind = PathKind.Root>(
32 path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,
33 logic: NoInfer<FieldValidator<TValue, TPathKind>>,
34): void {
35 assertPathIsCurrent(path);
36
37 const pathNode = FieldPathNode.unwrapFieldPath(path);
38 pathNode.builder.addSyncErrorRule((ctx) => {
39 return addDefaultField(logic(ctx as FieldContext<TValue, TPathKind>), ctx.fieldTree);
40 });
41}

Callers 15

hidden.spec.tsFile · 0.90
requiredFunction · 0.90
minFunction · 0.90
maxDateFunction · 0.90
minLengthFunction · 0.90
minDateFunction · 0.90
maxFunction · 0.90
emailFunction · 0.90
maxLengthFunction · 0.90
patternFunction · 0.90

Calls 4

assertPathIsCurrentFunction · 0.90
addDefaultFieldFunction · 0.90
unwrapFieldPathMethod · 0.80
addSyncErrorRuleMethod · 0.45

Tested by 5

testContextFunction · 0.40
sFunction · 0.40
sFunction · 0.40
s2Function · 0.40

Used in the wild real call sites across dependent graphs

searching dependent graphs…