refactor(forms): removed iterableToList

This commit is contained in:
vsavkin 2015-07-17 08:56:34 -07:00
parent c6409cb624
commit 13b1d85058
4 changed files with 3 additions and 13 deletions

View File

@ -195,8 +195,6 @@ class ListWrapper {
bool isListLikeIterable(obj) => obj is Iterable;
List iterableToList(Iterable ii) => ii.toList();
void iterateListLike(iter, fn(item)) {
assert(iter is Iterable);
for (var item in iter) {

View File

@ -260,13 +260,6 @@ export function iterateListLike(obj, fn: Function) {
}
}
}
export function iterableToList<T>(ii: any): List<T> {
var res = [];
for (var i of ii) {
res.push(i);
}
return res;
}
// Safari and Internet Explorer do not support the iterable parameter to the
// Set constructor. We work around that by manually adding the items.

View File

@ -1,4 +1,4 @@
import {ListWrapper, iterableToList, StringMapWrapper} from 'angular2/src/facade/collection';
import {ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
import {isBlank, BaseException, looseIdentical} from 'angular2/src/facade/lang';
import {ControlContainer} from './control_container';
@ -39,8 +39,7 @@ export function setUpControl(c: Control, dir: NgControl) {
export function composeNgValidator(ngValidators: QueryList<NgValidator>): Function {
if (isBlank(ngValidators)) return Validators.nullValidator;
return Validators.compose(
(<List<NgValidator>>iterableToList(ngValidators)).map(v => v.validator));
return Validators.compose(ngValidators.map(v => v.validator));
}
function _throwError(dir: NgControl, message: string): void {

View File

@ -19,7 +19,7 @@ import {QueryList} from 'angular2/core';
import {Query, ViewQuery, Component, Directive, View} from 'angular2/annotations';
import {NgIf, NgFor} from 'angular2/angular2';
import {ListWrapper, iterableToList} from 'angular2/src/facade/collection';
import {ListWrapper} from 'angular2/src/facade/collection';
import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter';