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

Function validate

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

Source from the content-addressed store, hash-verified

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

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