refactor(facade): Inline isBlank called with object-type argument (#11992)

This commit is contained in:
Alex Eagle
2016-09-30 09:26:53 -07:00
committed by Chuck Jazdzewski
parent a4af1561b7
commit b39d3a173e
49 changed files with 119 additions and 137 deletions

View File

@ -10,7 +10,6 @@ import {Directive, Inject, Input, OnChanges, Optional, Output, Self, SimpleChang
import {EventEmitter} from '../../facade/async';
import {ListWrapper} from '../../facade/collection';
import {isBlank} from '../../facade/lang';
import {FormArray, FormControl, FormGroup} from '../../model';
import {NG_ASYNC_VALIDATORS, NG_VALIDATORS, Validators} from '../../validators';
import {ControlContainer} from '../control_container';
@ -174,7 +173,7 @@ export class FormGroupDirective extends ControlContainer implements Form,
}
private _checkFormPresent() {
if (isBlank(this.form)) {
if (!this.form) {
ReactiveErrors.missingFormException();
}
}

View File

@ -35,8 +35,8 @@ export function controlPath(name: string, parent: ControlContainer): string[] {
}
export function setUpControl(control: FormControl, dir: NgControl): void {
if (isBlank(control)) _throwError(dir, 'Cannot find control with');
if (isBlank(dir.valueAccessor)) _throwError(dir, 'No value accessor for form control with');
if (!control) _throwError(dir, 'Cannot find control with');
if (!dir.valueAccessor) _throwError(dir, 'No value accessor for form control with');
control.validator = Validators.compose([control.validator, dir.validator]);
control.asyncValidator = Validators.composeAsync([control.asyncValidator, dir.asyncValidator]);
@ -139,7 +139,7 @@ export function isBuiltInAccessor(valueAccessor: ControlValueAccessor): boolean
// TODO: vsavkin remove it once https://github.com/angular/angular/issues/3011 is implemented
export function selectValueAccessor(
dir: NgControl, valueAccessors: ControlValueAccessor[]): ControlValueAccessor {
if (isBlank(valueAccessors)) return null;
if (!valueAccessors) return null;
var defaultAccessor: ControlValueAccessor;
var builtinAccessor: ControlValueAccessor;

View File

@ -114,7 +114,7 @@ export class Validators {
* of the individual error maps.
*/
static compose(validators: ValidatorFn[]): ValidatorFn {
if (isBlank(validators)) return null;
if (!validators) return null;
var presentValidators = validators.filter(isPresent);
if (presentValidators.length == 0) return null;
@ -124,7 +124,7 @@ export class Validators {
}
static composeAsync(validators: AsyncValidatorFn[]): AsyncValidatorFn {
if (isBlank(validators)) return null;
if (!validators) return null;
var presentValidators = validators.filter(isPresent);
if (presentValidators.length == 0) return null;