MCPcopy Index your code
hub / github.com/angular/angular-cli / callRuleAsync

Function callRuleAsync

packages/angular_devkit/schematics/src/rules/call.ts:77–98  ·  view source on GitHub ↗
(rule: Rule, tree: Tree, context: SchematicContext)

Source from the content-addressed store, hash-verified

75}
76
77async function callRuleAsync(rule: Rule, tree: Tree, context: SchematicContext): Promise<Tree> {
78 let result = await rule(tree, context);
79
80 while (typeof result === 'function') {
81 // This is considered a Rule, chain the rule and return its output.
82 result = await result(tree, context);
83 }
84
85 if (typeof result === 'undefined') {
86 return tree;
87 }
88
89 if (isObservable(result)) {
90 result = await lastValueFrom(result.pipe(defaultIfEmpty(tree)));
91 }
92
93 if (result && TreeSymbol in result) {
94 return result;
95 }
96
97 throw new InvalidRuleResultException(result);
98}

Callers 1

callRuleFunction · 0.85

Calls 1

resultFunction · 0.85

Tested by

no test coverage detected