From 13b1d850586dab3d02ba0b06dc417a29203933fe Mon Sep 17 00:00:00 2001 From: vsavkin Date: Fri, 17 Jul 2015 08:56:34 -0700 Subject: [PATCH] refactor(forms): removed iterableToList --- modules/angular2/src/facade/collection.dart | 2 -- modules/angular2/src/facade/collection.ts | 7 ------- modules/angular2/src/forms/directives/shared.ts | 5 ++--- .../angular2/test/core/compiler/query_integration_spec.ts | 2 +- 4 files changed, 3 insertions(+), 13 deletions(-) diff --git a/modules/angular2/src/facade/collection.dart b/modules/angular2/src/facade/collection.dart index 9348664159..f2c27d4550 100644 --- a/modules/angular2/src/facade/collection.dart +++ b/modules/angular2/src/facade/collection.dart @@ -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) { diff --git a/modules/angular2/src/facade/collection.ts b/modules/angular2/src/facade/collection.ts index a364bba1af..82169bc727 100644 --- a/modules/angular2/src/facade/collection.ts +++ b/modules/angular2/src/facade/collection.ts @@ -260,13 +260,6 @@ export function iterateListLike(obj, fn: Function) { } } } -export function iterableToList(ii: any): List { - 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. diff --git a/modules/angular2/src/forms/directives/shared.ts b/modules/angular2/src/forms/directives/shared.ts index 36d2d8dedf..0df149a307 100644 --- a/modules/angular2/src/forms/directives/shared.ts +++ b/modules/angular2/src/forms/directives/shared.ts @@ -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): Function { if (isBlank(ngValidators)) return Validators.nullValidator; - return Validators.compose( - (>iterableToList(ngValidators)).map(v => v.validator)); + return Validators.compose(ngValidators.map(v => v.validator)); } function _throwError(dir: NgControl, message: string): void { diff --git a/modules/angular2/test/core/compiler/query_integration_spec.ts b/modules/angular2/test/core/compiler/query_integration_spec.ts index e5049a4482..1248cc00a0 100644 --- a/modules/angular2/test/core/compiler/query_integration_spec.ts +++ b/modules/angular2/test/core/compiler/query_integration_spec.ts @@ -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';