refactor(compiler-cli): reformat directive/pipe metadata extraction (#39961)
The prior usage of a ternary expression caused the code to be formatted in a weird way, so this commit replaces the ternary with an `if` statement. PR Close #39961
This commit is contained in:
parent
dd8a31838c
commit
e69288418c
|
@ -65,8 +65,9 @@ export function toR3ComponentMeta<TExpression>(
|
|||
|
||||
let wrapDirectivesAndPipesInClosure = false;
|
||||
|
||||
const directives: R3UsedDirectiveMetadata[] = metaObj.has('directives') ?
|
||||
metaObj.getArray('directives').map(directive => {
|
||||
let directives: R3UsedDirectiveMetadata[] = [];
|
||||
if (metaObj.has('directives')) {
|
||||
directives = metaObj.getArray('directives').map(directive => {
|
||||
const directiveExpr = directive.getObject();
|
||||
const type = directiveExpr.getValue('type');
|
||||
const selector = directiveExpr.getString('selector');
|
||||
|
@ -89,18 +90,20 @@ export function toR3ComponentMeta<TExpression>(
|
|||
directiveExpr.getArray('exportAs').map(exportAs => exportAs.getString()) :
|
||||
null,
|
||||
};
|
||||
}) :
|
||||
[];
|
||||
});
|
||||
}
|
||||
|
||||
const pipes = metaObj.has('pipes') ? metaObj.getObject('pipes').toMap(value => {
|
||||
let pipes = new Map<string, o.Expression>();
|
||||
if (metaObj.has('pipes')) {
|
||||
pipes = metaObj.getObject('pipes').toMap(value => {
|
||||
if (value.isFunction()) {
|
||||
wrapDirectivesAndPipesInClosure = true;
|
||||
return value.getFunctionReturnValue().getOpaque();
|
||||
} else {
|
||||
return value.getOpaque();
|
||||
}
|
||||
}) :
|
||||
new Map<string, o.Expression>();
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
...toR3DirectiveMeta(metaObj, code, sourceUrl),
|
||||
|
|
Loading…
Reference in New Issue