MCPcopy Index your code
hub / github.com/angular/angular / compose

Function compose

packages/forms/src/validators.ts:665–673  ·  view source on GitHub ↗

* Merges synchronous validators into a single validator function. * See `Validators.compose` for additional information.

(validators: (ValidatorFn | null | undefined)[] | null)

Source from the content-addressed store, hash-verified

663 * See `Validators.compose` for additional information.
664 */
665function compose(validators: (ValidatorFn | null | undefined)[] | null): ValidatorFn | null {
666 if (!validators) return null;
667 const presentValidators: ValidatorFn[] = validators.filter(isPresent) as any;
668 if (presentValidators.length == 0) return null;
669
670 return function (control: AbstractControl) {
671 return mergeErrors(executeValidators<ValidatorFn>(control, presentValidators));
672 };
673}
674
675/**
676 * Accepts a list of validators of different possible shapes (`Validator` and `ValidatorFn`),

Callers 2

composeMethod · 0.85
composeValidatorsFunction · 0.85

Calls 3

mergeErrorsFunction · 0.85
executeValidatorsFunction · 0.85
filterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…