refactor(facade): Remove most of StringMapWrapper facade. (#12022)
This change mostly automated by
12012b07a2
with some manual fixes.
This commit is contained in:

committed by
Chuck Jazdzewski

parent
ed9c2b6281
commit
b64b5ece65
@ -9,7 +9,6 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
|
||||
import {AsyncValidatorFn, ValidatorFn} from './directives/validators';
|
||||
import {StringMapWrapper} from './facade/collection';
|
||||
import {isArray, isPresent} from './facade/lang';
|
||||
import {AbstractControl, FormArray, FormControl, FormGroup} from './model';
|
||||
|
||||
@ -75,8 +74,8 @@ export class FormBuilder {
|
||||
/** @internal */
|
||||
_reduceControls(controlsConfig: {[k: string]: any}): {[key: string]: AbstractControl} {
|
||||
var controls: {[key: string]: AbstractControl} = {};
|
||||
StringMapWrapper.forEach(controlsConfig, (controlConfig: any, controlName: string) => {
|
||||
controls[controlName] = this._createControl(controlConfig);
|
||||
Object.keys(controlsConfig).forEach(controlName => {
|
||||
controls[controlName] = this._createControl(controlsConfig[controlName]);
|
||||
});
|
||||
return controls;
|
||||
}
|
||||
|
@ -939,9 +939,9 @@ export class FormGroup extends AbstractControl {
|
||||
*/
|
||||
setValue(value: {[key: string]: any}, {onlySelf}: {onlySelf?: boolean} = {}): void {
|
||||
this._checkAllValuesPresent(value);
|
||||
StringMapWrapper.forEach(value, (newValue: any, name: string) => {
|
||||
Object.keys(value).forEach(name => {
|
||||
this._throwIfControlMissing(name);
|
||||
this.controls[name].setValue(newValue, {onlySelf: true});
|
||||
this.controls[name].setValue(value[name], {onlySelf: true});
|
||||
});
|
||||
this.updateValueAndValidity({onlySelf: onlySelf});
|
||||
}
|
||||
@ -968,9 +968,9 @@ export class FormGroup extends AbstractControl {
|
||||
* ```
|
||||
*/
|
||||
patchValue(value: {[key: string]: any}, {onlySelf}: {onlySelf?: boolean} = {}): void {
|
||||
StringMapWrapper.forEach(value, (newValue: any, name: string) => {
|
||||
Object.keys(value).forEach(name => {
|
||||
if (this.controls[name]) {
|
||||
this.controls[name].patchValue(newValue, {onlySelf: true});
|
||||
this.controls[name].patchValue(value[name], {onlySelf: true});
|
||||
}
|
||||
});
|
||||
this.updateValueAndValidity({onlySelf: onlySelf});
|
||||
@ -1046,7 +1046,7 @@ export class FormGroup extends AbstractControl {
|
||||
|
||||
/** @internal */
|
||||
_forEachChild(cb: (v: any, k: string) => void): void {
|
||||
StringMapWrapper.forEach(this.controls, cb);
|
||||
Object.keys(this.controls).forEach(k => cb(this.controls[k], k));
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
|
@ -152,5 +152,5 @@ function _mergeErrors(arrayOfErrors: any[]): {[key: string]: any} {
|
||||
arrayOfErrors.reduce((res: {[key: string]: any}, errors: {[key: string]: any}) => {
|
||||
return isPresent(errors) ? StringMapWrapper.merge(res, errors) : res;
|
||||
}, {});
|
||||
return StringMapWrapper.isEmpty(res) ? null : res;
|
||||
return Object.keys(res).length === 0 ? null : res;
|
||||
}
|
||||
|
Reference in New Issue
Block a user