src/Utl.js
function makeCounterMap() {
  var map = new WeakMap();
  return {
    init(obj) { map.set(obj, 0); },
    incr(obj) {
      console.assert(map.has(obj), "Object must be in counter map.");
      map.set(obj, map.get(obj) + 1);
    },
     get(obj)  { return map.get(obj); }
  };
}
function makeCounterMap() {
  var map = new WeakMap();
  return {
    init(obj) { map.set(obj, 0); },
    incr(obj) {
      console.assert(map.has(obj), "Object must be in counter map.");
      map.set(obj, map.get(obj) + 1);
    },
     get(obj)  { return map.get(obj); }
  };
}
function makeCounterMap ( ) { var map = new WeakMap ( ) ; return { init ( obj ) { map . set ( obj , 0 ) ; } , incr ( obj ) { console . assert ( map . has ( obj ) , "Object must be in counter map." ) ; map . set ( obj , map . get ( obj ) + 1 ) ; } , get ( obj ) { return map . get ( obj ) ; } } ; }
Make a counter for occurrences of something on an object, using weak map. For example, used to count recomputations of "keepXXX" results.
Make a counter for occurrences of something on an object using weak map . For example used to count recomputations of keepXXX results .