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

Function normalizeErrors

packages/forms/signals/src/field/validation.ts:376–386  ·  view source on GitHub ↗

Normalizes a validation result to a list of validation errors.

(error: T | readonly T[])

Source from the content-addressed store, hash-verified

374
375/** Normalizes a validation result to a list of validation errors. */
376function normalizeErrors<T extends ValidationResult>(error: T | readonly T[]): readonly T[] {
377 if (error === undefined) {
378 return [];
379 }
380
381 if (isArray(error)) {
382 return error as readonly T[];
383 }
384
385 return [error as T];
386}
387
388/**
389 * Sets the given field on the given error(s) if it does not already have a field.

Callers 1

Calls 1

isArrayFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…