MCPcopy
hub / github.com/angular/angular / extractDefListOrFactory

Function extractDefListOrFactory

packages/core/src/render3/definition.ts:653–674  ·  view source on GitHub ↗
(
  dependencies: TypeOrFactory<DependencyTypeList> | undefined,
  defExtractor: (type: Type<unknown>) => T | null,
)

Source from the content-addressed store, hash-verified

651}
652
653export function extractDefListOrFactory<T>(
654 dependencies: TypeOrFactory<DependencyTypeList> | undefined,
655 defExtractor: (type: Type<unknown>) => T | null,
656): (() => T[]) | T[] | null {
657 if (!dependencies) {
658 return null;
659 }
660
661 return () => {
662 const resolvedDependencies = typeof dependencies === 'function' ? dependencies() : dependencies;
663 const result: T[] = [];
664
665 for (const dep of resolvedDependencies) {
666 const definition = defExtractor(dep);
667 if (definition !== null) {
668 result.push(definition);
669 }
670 }
671
672 return result;
673 };
674}
675
676/**
677 * A map that contains the generated component IDs and type.

Callers 2

ɵɵsetComponentScopeFunction · 0.90
ɵɵdefineComponentFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…