util/mapJsonToItemAnnotation.js
function flatten(level, map) {
  for (var key in map) {
    var kmap = map[key];
    // we found a definition
    if (kmap._VAL_ || kmap._TAG_) {
      if (kmap._VAL_) {
        flatFields[key] = { level: level, _VAL_ : kmap._VAL_};
      } else {
        flatFields[key] = { level: level, _TAG_ : kmap._TAG_};
      }
    // presumed a level def
    } else {
      var here = level.slice(0);
      here.push(key);
      flatten(here, kmap);
    }
  }
}
function flatten(level, map) {
  for (var key in map) {
    var kmap = map[key];
    // we found a definition
    if (kmap._VAL_ || kmap._TAG_) {
      if (kmap._VAL_) {
        flatFields[key] = { level: level, _VAL_ : kmap._VAL_};
      } else {
        flatFields[key] = { level: level, _TAG_ : kmap._TAG_};
      }
    // presumed a level def
    } else {
      var here = level.slice(0);
      here.push(key);
      flatten(here, kmap);
    }
  }
}
function flatten ( level , map ) { for ( var key in map ) { var kmap = map [ key ] ; // we found a definition if ( kmap . _VAL_ || kmap . _TAG_ ) { if ( kmap . _VAL_ ) { flatFields [ key ] = { level : level , _VAL_ : kmap . _VAL_ } ; } else { flatFields [ key ] = { level : level , _TAG_ : kmap . _TAG_ } ; } // presumed a level def } else { var here = level . slice ( 0 ) ; here . push ( key ) ; flatten ( here , kmap ) ; } } }
recursively flatten fields to flatFields for fast lookups
recursively flatten fields to flatFields for fast lookups