MCPcopy
hub / github.com/angular/angular / email

Function email

packages/forms/signals/src/api/rules/validation/email.ts:61–82  ·  view source on GitHub ↗
(
  path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>,
  config?: BaseValidatorConfig<string, TPathKind>,
)

Source from the content-addressed store, hash-verified

59 * @publicApi 22.0
60 */
61export function email<TPathKind extends PathKind = PathKind.Root>(
62 path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>,
63 config?: BaseValidatorConfig<string, TPathKind>,
64) {
65 validate(path, (ctx) => {
66 if (config?.when && !config.when(ctx)) {
67 return undefined;
68 }
69 if (isEmpty(ctx.value())) {
70 return undefined;
71 }
72 if (!EMAIL_REGEXP.test(ctx.value())) {
73 if (config?.error) {
74 return getOption(config.error, ctx);
75 } else {
76 return emailError({message: getOption(config?.message, ctx)});
77 }
78 }
79
80 return undefined;
81 });
82}

Callers 11

LoginComponentClass · 0.90
AppClass · 0.90
AppClass · 0.90
AppClass · 0.90
AppClass · 0.90
AppClass · 0.90
AppClass · 0.90
AppClass · 0.90
LoginAppClass · 0.90
compat.spec.tsFile · 0.85
email.spec.tsFile · 0.85

Calls 7

validateFunction · 0.90
isEmptyFunction · 0.90
getOptionFunction · 0.90
emailErrorFunction · 0.90
whenMethod · 0.80
valueMethod · 0.65
testMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…