refactor(forms): removed iterableToList
This commit is contained in:
parent
c6409cb624
commit
13b1d85058
|
@ -195,8 +195,6 @@ class ListWrapper {
|
||||||
|
|
||||||
bool isListLikeIterable(obj) => obj is Iterable;
|
bool isListLikeIterable(obj) => obj is Iterable;
|
||||||
|
|
||||||
List iterableToList(Iterable ii) => ii.toList();
|
|
||||||
|
|
||||||
void iterateListLike(iter, fn(item)) {
|
void iterateListLike(iter, fn(item)) {
|
||||||
assert(iter is Iterable);
|
assert(iter is Iterable);
|
||||||
for (var item in iter) {
|
for (var item in iter) {
|
||||||
|
|
|
@ -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
|
// Safari and Internet Explorer do not support the iterable parameter to the
|
||||||
// Set constructor. We work around that by manually adding the items.
|
// Set constructor. We work around that by manually adding the items.
|
||||||
|
|
|
@ -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 {isBlank, BaseException, looseIdentical} from 'angular2/src/facade/lang';
|
||||||
|
|
||||||
import {ControlContainer} from './control_container';
|
import {ControlContainer} from './control_container';
|
||||||
|
@ -39,8 +39,7 @@ export function setUpControl(c: Control, dir: NgControl) {
|
||||||
|
|
||||||
export function composeNgValidator(ngValidators: QueryList<NgValidator>): Function {
|
export function composeNgValidator(ngValidators: QueryList<NgValidator>): Function {
|
||||||
if (isBlank(ngValidators)) return Validators.nullValidator;
|
if (isBlank(ngValidators)) return Validators.nullValidator;
|
||||||
return Validators.compose(
|
return Validators.compose(ngValidators.map(v => v.validator));
|
||||||
(<List<NgValidator>>iterableToList(ngValidators)).map(v => v.validator));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _throwError(dir: NgControl, message: string): void {
|
function _throwError(dir: NgControl, message: string): void {
|
||||||
|
|
|
@ -19,7 +19,7 @@ import {QueryList} from 'angular2/core';
|
||||||
import {Query, ViewQuery, Component, Directive, View} from 'angular2/annotations';
|
import {Query, ViewQuery, Component, Directive, View} from 'angular2/annotations';
|
||||||
|
|
||||||
import {NgIf, NgFor} from 'angular2/angular2';
|
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';
|
import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue