converts an array of objects into an object, where each object's key is its id (by default)
426055
function arrayToObject(arrayOfObjects) {
    var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'id';

    var convertedObject = {};

    arrayOfObjects.forEach(function (object) {
      convertedObject[object[key]] = object;
    });

    return convertedObject;
  }
1245694
function nest(array, insert) {
  let obj;

  array.reverse().forEach(key => {
    obj = { [key]: insert };
    insert = obj;
  });

  return insert;
}
412767
function pick(obj, keys) {
  var result = {};
  for (var i = 0, length = keys.length; i < length; i++) {
    var key = keys[i];
    if (key in obj) result[key] = obj[key];
  }
  return result;
}
220519
def _dict_to_list_ids(objects):
    '''
    
    '''
    list_with_ids = []
    for key, value in six.iteritems(objects):
        element = {'id': key}
        element.update(value)
        list_with_ids.append(element)
    return list_with_ids
763629
private String _serializeArray(Array array, Map<Object, String> done, String id) throws ConverterException {
	return _serializeList(array.toList(), done, id);
    }
777122
function(object, objects) {
		for(var i=0; i<arguments.length; i++) {
			var o = arguments[i];
			
			for(var j in o) {
				if(!(j in object)) {
					object[j] = o[j];
				}
			}
		}
		
		return object;
	}
154133
function obj(/*key,value, key,value ...*/) {
    var result = {}
    for(var n=0; n<arguments.length; n+=2) {
        result[arguments[n]] = arguments[n+1]
    }
    return result
}
747483
function array(obj) {
  if ('array' === type(obj)) return obj;
  if ('arguments' === type(obj)) return Array.prototype.slice.call(obj, 0);

  return obj  // Only transform objects in to an array when they exist.
    ? [obj]
    : [];
}
304581
def from_array(array):
        
        if array is None or not array:
            return None
        # end if
        assert_type_or_raise(array, dict, parameter_name="array")

        data = {}
        data['migrate_to_chat_id'] = int(array.get('migrate_to_chat_id')) if array.get('migrate_to_chat_id') is not None else None
        data['retry_after'] = int(array.get('retry_after')) if array.get('retry_after') is not None else None
        data['_raw'] = array
        return ResponseParameters(**data)
1227163
function toArray(id, time) {
  var o = [
    id,
    Math.round(this._now / 1000),
    time,
    this._cmd];
  return o;
}
1233720
def from_array(array):
        
        if array is None or not array:
            return None
        # end if
        assert_type_or_raise(array, dict, parameter_name="array")

        data = {}
        data['source'] = u(array.get('source'))
        data['type'] = u(array.get('type'))
        data['element_hash'] = u(array.get('element_hash'))
        data['message'] = u(array.get('message'))

        instance = PassportElementErrorUnspecified(**data)
        instance._raw = array
        return instance
1253126
function to_array(obj) { var result, i
        result = []
        obj    = Object(obj)
        for (i = size(obj); i--;)
            if (i in obj)  result[i] = obj[i]

        return result
    }
126066
static public Object get(Object[] array, Object key)
    {
        Object o = getByIdentity(array, key);
        if (o != null)
        {
            return o;
        }

        return getByEquality(array, key);
    }
818103
function indexById(array, id) {
    if (!array) return -1;
    return smartIndexOf(array, function (obj) {
        return obj.id === id;
    });
}
1111626
function (key, obj) {
        'use strict';
        var keysArr = key.split('.'),
            lastKeyPart = keysArr.pop(),
            len = keysArr.length,
            i, k, objNext;
        for (i = 0; i < len; i += 1) {
            k = keysArr[i];
            objNext = obj[k];
            if (!isObj(objNext)) {
                objNext = obj[k] = {};
            }
            obj = objNext;
        }
        return {
            node: obj,
            key: lastKeyPart
        };
    }
451031
function listToObject(list, key) {
        var length, result, i, obj, keyValue;
        if (!list) {
            list = [];
        }
        length = list.length;
        result = { valids: {}, discarded: [] };
        for (i = 0; i < length; i += 1) {
            obj = list[i];
            keyValue = obj[key];
            // discard the object without a key
            if (keyValue) {
                result.valids[keyValue] = obj;
            } else {
                result.discarded.push(obj);
            }
        }
        return result;
    }
469491
function _convertPairToObject(pair) {
  var keyId = pair[0];
  var valueIds = pair[1];
  return {
    keyId: keyId,
    valueIds: valueIds
  };
}