refactor: simplify isPresent(x) ? x : y to x || y (#12166)

Closes #12166
This commit is contained in:
Victor Berchet
2016-10-07 18:11:37 -07:00
committed by Tobias Bosch
parent bdcf46f82e
commit d972d82354
18 changed files with 40 additions and 43 deletions

View File

@ -304,7 +304,7 @@ export class CompileTemplateMetadata {
this.styleUrls = _normalizeArray(styleUrls);
this.externalStylesheets = _normalizeArray(externalStylesheets);
this.animations = isPresent(animations) ? ListWrapper.flatten(animations) : [];
this.ngContentSelectors = isPresent(ngContentSelectors) ? ngContentSelectors : [];
this.ngContentSelectors = ngContentSelectors || [];
if (isPresent(interpolation) && interpolation.length != 2) {
throw new Error(`'interpolation' should have a start and an end symbol.`);
}
@ -590,7 +590,7 @@ export function removeIdentifierDuplicates<T extends CompileMetadataWithIdentifi
}
function _normalizeArray(obj: any[]): any[] {
return isPresent(obj) ? obj : [];
return obj || [];
}
export function isStaticSymbol(value: any): value is StaticSymbol {