MCPcopy
hub / github.com/angular/angular-cli / chain

Function chain

packages/angular_devkit/schematics/src/rules/base.ts:35–50  ·  view source on GitHub ↗
(rules: Iterable<Rule> | AsyncIterable<Rule>)

Source from the content-addressed store, hash-verified

33 * Chain multiple rules into a single rule.
34 */
35export function chain(rules: Iterable<Rule> | AsyncIterable<Rule>): Rule {
36 return async (initialTree, context) => {
37 let intermediateTree: Observable<Tree> | undefined;
38 if (Symbol.asyncIterator in rules) {
39 for await (const rule of rules) {
40 intermediateTree = callRule(rule, intermediateTree ?? initialTree, context);
41 }
42 } else {
43 for (const rule of rules) {
44 intermediateTree = callRule(rule, intermediateTree ?? initialTree, context);
45 }
46 }
47
48 return () => intermediateTree;
49 };
50}
51
52/**
53 * Apply multiple rules to a source, and returns the source transformed.

Callers 15

index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
generateFromFilesFunction · 0.90
dependency_spec.tsFile · 0.90

Calls 1

callRuleFunction · 0.90

Tested by

no test coverage detected