diff --git a/modules/angular2/src/facade/collection.dart b/modules/angular2/src/facade/collection.dart index b903e584f2..5768c09af1 100644 --- a/modules/angular2/src/facade/collection.dart +++ b/modules/angular2/src/facade/collection.dart @@ -232,6 +232,14 @@ class ListWrapper { static bool isImmutable(List l) { return l is UnmodifiableListView; } + + static List flatten(List l) { + final res = []; + l.forEach((item) { + res.addAll(item); + }); + return res; + } } bool isListLikeIterable(obj) => obj is Iterable; diff --git a/modules/angular2/src/facade/collection.ts b/modules/angular2/src/facade/collection.ts index ef6587492c..636bd4657d 100644 --- a/modules/angular2/src/facade/collection.ts +++ b/modules/angular2/src/facade/collection.ts @@ -278,6 +278,11 @@ export class ListWrapper { } static isImmutable(list: any[]): boolean { return Object.isSealed(list); } + static flatten(array: T[][]): T[] { + let res = []; + array.forEach((a) => res = res.concat(a)); + return res; + } } export function isListLikeIterable(obj: any): boolean {