lib/utils.js
function toMap(arr, fn) {
  var obj = {};
  var i, elem;
  for (i = 0; i < arr.length; i++) {
    elem = arr[i];
    obj[fn(elem)] = elem;
  }
  return obj;
}
function toMap(arr, fn) {
  var obj = {};
  var i, elem;
  for (i = 0; i < arr.length; i++) {
    elem = arr[i];
    obj[fn(elem)] = elem;
  }
  return obj;
}
function toMap ( arr , fn ) { var obj = { } ; var i , elem ; for ( i = 0 ; i < arr . length ; i ++ ) { elem = arr [ i ] ; obj [ fn ( elem ) ] = elem ; } return obj ; }
Convert array to map.

@param arr {Array} Elements.
@param fn {Function} Function returning an element's key.
Convert array to map .