code: function mapObjects(arr, idKey) {
    var r = {};
    var len = arr.length;
  
    for (var i = 0; i < len; i++) {
      var item = arr[i];
      var id = isFunction(idKey) ? idKey(item, i) : item[idKey];
      r[id] = item;
    }
  
    return r;
  }
docs: arr, idKey/getId