refactor(collection): use Map instead of Object

This commit is contained in:
vsavkin
2014-10-18 17:50:55 -04:00
parent 1f4caa8773
commit 2a4b63b614
4 changed files with 11 additions and 12 deletions

View File

@ -9,7 +9,7 @@ class MapWrapper {
static void set(m, k, v){ m[k] = v; }
static contains(m, k) => m.containsKey(k);
static forEach(m, fn) {
m.forEach(fn);
m.forEach((k,v) => fn(v,k));
}
}

View File

@ -4,13 +4,11 @@ export var Set = window.Set;
export class MapWrapper {
static create():Map { return new Map(); }
static get(m, k) { return m[k]; }
static set(m, k, v) { m[k] = v; }
static contains(m, k) { return m[k] != undefined; }
static get(m, k) { return m.get(k); }
static set(m, k, v) { m.set(k,v); }
static contains(m, k) { return m.has(k); }
static forEach(m, fn) {
for(var k in m) {
fn(k, m[k]);
}
m.forEach(fn);
}
}