From f1796d67f4c8532ddd762c07be1017a182e96948 Mon Sep 17 00:00:00 2001 From: vsavkin Date: Sun, 6 Mar 2016 20:20:55 -0800 Subject: [PATCH] feat(facade): add .values to StringMapWrapper --- modules/angular2/src/facade/collection.dart | 4 ++++ modules/angular2/src/facade/collection.ts | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/modules/angular2/src/facade/collection.dart b/modules/angular2/src/facade/collection.dart index 8e7277f60b..b903e584f2 100644 --- a/modules/angular2/src/facade/collection.dart +++ b/modules/angular2/src/facade/collection.dart @@ -85,6 +85,10 @@ class StringMapWrapper { return a.keys.toList(); } + static List values(Map a) { + return a.values.toList(); + } + static bool isEmpty(Map m) => m.isEmpty; static bool equals/**/(Map/**/ m1, Map/**/ m2) { if (m1.length != m2.length) { diff --git a/modules/angular2/src/facade/collection.ts b/modules/angular2/src/facade/collection.ts index f4c3f2752a..ef6587492c 100644 --- a/modules/angular2/src/facade/collection.ts +++ b/modules/angular2/src/facade/collection.ts @@ -116,6 +116,12 @@ export class StringMapWrapper { } static set(map: {[key: string]: V}, key: string, value: V) { map[key] = value; } static keys(map: {[key: string]: any}): string[] { return Object.keys(map); } + static values(map: {[key: string]: T}): T[] { + return Object.keys(map).reduce((r, a) => { + r.push(map[a]); + return r; + }, []); + } static isEmpty(map: {[key: string]: any}): boolean { for (var prop in map) { return false;