feat(change_detection): provide error context for change detection errors

This commit is contained in:
vsavkin
2015-07-23 18:01:34 -07:00
parent e744409cb9
commit c2bbda02a1
17 changed files with 147 additions and 36 deletions

View File

@ -34,7 +34,13 @@ class IterableMap extends IterableBase<List> {
class MapWrapper {
static Map clone(Map m) => new Map.from(m);
// in opposite to JS, Dart does not create a new map
static Map createFromStringMap(Map m) => m;
// in opposite to JS, Dart does not create a new map
static Map toStringMap(Map m) => m;
static Map createFromPairs(List pairs) => pairs.fold({}, (m, p) {
m[p[0]] = p[1];
return m;

View File

@ -62,6 +62,11 @@ export class MapWrapper {
}
return result;
}
static toStringMap<T>(m: Map<string, T>): StringMap<string, T> {
var r = {};
m.forEach((v, k) => r[k] = v);
return r;
}
static createFromPairs(pairs: List<any>): Map<any, any> { return createMapFromPairs(pairs); }
static forEach<K, V>(m: Map<K, V>, fn: /*(V, K) => void*/ Function) { m.forEach(<any>fn); }
static get<K, V>(map: Map<K, V>, key: K): V { return map.get(key); }