feat(facade): add .values to StringMapWrapper

This commit is contained in:
vsavkin 2016-03-06 20:20:55 -08:00 committed by Victor Savkin
parent cb38d72ff4
commit f1796d67f4
2 changed files with 10 additions and 0 deletions

View File

@ -85,6 +85,10 @@ class StringMapWrapper {
return a.keys.toList(); return a.keys.toList();
} }
static List values(Map<String, dynamic> a) {
return a.values.toList();
}
static bool isEmpty(Map m) => m.isEmpty; static bool isEmpty(Map m) => m.isEmpty;
static bool equals/*<V>*/(Map/*<String,V>*/ m1, Map/*<String,V>*/ m2) { static bool equals/*<V>*/(Map/*<String,V>*/ m1, Map/*<String,V>*/ m2) {
if (m1.length != m2.length) { if (m1.length != m2.length) {

View File

@ -116,6 +116,12 @@ export class StringMapWrapper {
} }
static set<V>(map: {[key: string]: V}, key: string, value: V) { map[key] = value; } static set<V>(map: {[key: string]: V}, key: string, value: V) { map[key] = value; }
static keys(map: {[key: string]: any}): string[] { return Object.keys(map); } static keys(map: {[key: string]: any}): string[] { return Object.keys(map); }
static values<T>(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 { static isEmpty(map: {[key: string]: any}): boolean {
for (var prop in map) { for (var prop in map) {
return false; return false;