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

Function metadata

packages/forms/signals/src/api/rules/metadata.ts:33–53  ·  view source on GitHub ↗
(
  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,
  key: TKey,
  logic: NoInfer<
    LogicFn<
      TValue,
      TKey extends LimitSelectionKey ? LimitKey<TValue> : MetadataSetterType<TKey>,
      TPathKind
    >
  >,
)

Source from the content-addressed store, hash-verified

31 * @publicApi 22.0
32 */
33export function metadata<
34 TValue,
35 TKey extends MetadataKey<any, any, any>,
36 TPathKind extends PathKind = PathKind.Root,
37>(
38 path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,
39 key: TKey,
40 logic: NoInfer<
41 LogicFn<
42 TValue,
43 TKey extends LimitSelectionKey ? LimitKey<TValue> : MetadataSetterType<TKey>,
44 TPathKind
45 >
46 >,
47): TKey {
48 assertPathIsCurrent(path);
49
50 const pathNode = FieldPathNode.unwrapFieldPath(path);
51 pathNode.builder.addMetadataRule(key, logic);
52 return key;
53}
54
55/**
56 * A reducer that determines the accumulated value for a metadata key by reducing the individual

Callers 15

requiredFunction · 0.90
minFunction · 0.90
maxDateFunction · 0.90
minLengthFunction · 0.90
minDateFunction · 0.90
maxFunction · 0.90
maxLengthFunction · 0.90
validateAsyncFunction · 0.90
patternFunction · 0.90
validateStandardSchemaFunction · 0.90

Calls 3

assertPathIsCurrentFunction · 0.90
unwrapFieldPathMethod · 0.80
addMetadataRuleMethod · 0.45

Tested by 2

sFunction · 0.68