lib/third_party/tracing/base/iteration_helpers.js
function arrayToDict(array, valueToKeyFn, opt_this) {
    opt_this = opt_this || this;
    var result = {};
    var length = array.length;
    for (var i = 0; i < length; i++) {
      var value = array[i];
      var key = valueToKeyFn.call(opt_this, value);
      result[key] = value;
    }
    return result;
  }
function arrayToDict(array, valueToKeyFn, opt_this) {
    opt_this = opt_this || this;
    var result = {};
    var length = array.length;
    for (var i = 0; i < length; i++) {
      var value = array[i];
      var key = valueToKeyFn.call(opt_this, value);
      result[key] = value;
    }
    return result;
  }
function arrayToDict ( array , valueToKeyFn , opt_this ) { opt_this = opt_this || this ; var result = { } ; var length = array . length ; for ( var i = 0 ; i < length ; i ++ ) { var value = array [ i ] ; var key = valueToKeyFn . call ( opt_this , value ) ; result [ key ] = value ; } return result ; }
Convert an array to a dictionary.

Every element in the array is mapped in the dictionary to the key returned
by the provided function:

dictionary[valueToKeyFn(element)] = element;

@param {!Array} array Arbitrary array.
@param {function(*): string} valueToKeyFn Function mapping array elements
to dictionary keys.
@param {*=} opt_this Optional 'this' context for valueToKeyFn.
Convert an array to a dictionary .