refactor(facade): Inline isBlank called with object-type argument (#11992)
This commit is contained in:

committed by
Chuck Jazdzewski

parent
e884f4854d
commit
0286956107
@ -8,7 +8,7 @@
|
||||
|
||||
import {ListWrapper} from '../facade/collection';
|
||||
import {BaseError, WrappedError} from '../facade/errors';
|
||||
import {isBlank, stringify} from '../facade/lang';
|
||||
import {stringify} from '../facade/lang';
|
||||
import {Type} from '../type';
|
||||
|
||||
import {ReflectiveInjector} from './reflective_injector';
|
||||
@ -229,7 +229,7 @@ export class NoAnnotationError extends BaseError {
|
||||
var signature: string[] = [];
|
||||
for (var i = 0, ii = params.length; i < ii; i++) {
|
||||
var parameter = params[i];
|
||||
if (isBlank(parameter) || parameter.length == 0) {
|
||||
if (!parameter || parameter.length == 0) {
|
||||
signature.push('?');
|
||||
} else {
|
||||
signature.push(parameter.map(stringify).join(' '));
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {isBlank, stringify} from '../facade/lang';
|
||||
import {stringify} from '../facade/lang';
|
||||
|
||||
import {resolveForwardRef} from './forward_ref';
|
||||
|
||||
@ -32,7 +32,7 @@ export class ReflectiveKey {
|
||||
* Private
|
||||
*/
|
||||
constructor(public token: Object, public id: number) {
|
||||
if (isBlank(token)) {
|
||||
if (!token) {
|
||||
throw new Error('Token must be defined!');
|
||||
}
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ function _normalizeProviders(providers: Provider[], res: Provider[]): Provider[]
|
||||
|
||||
export function constructDependencies(
|
||||
typeOrFunc: any, dependencies: any[]): ReflectiveDependency[] {
|
||||
if (isBlank(dependencies)) {
|
||||
if (!dependencies) {
|
||||
return _dependenciesFor(typeOrFunc);
|
||||
} else {
|
||||
var params: any[][] = dependencies.map(t => [t]);
|
||||
@ -211,7 +211,7 @@ export function constructDependencies(
|
||||
|
||||
function _dependenciesFor(typeOrFunc: any): ReflectiveDependency[] {
|
||||
var params = reflector.parameters(typeOrFunc);
|
||||
if (isBlank(params)) return [];
|
||||
if (!params) return [];
|
||||
if (params.some(isBlank)) {
|
||||
throw new NoAnnotationError(typeOrFunc, params);
|
||||
}
|
||||
|
Reference in New Issue
Block a user