Rename key in object without changing its position
429334
function renameKey(obj, prevKey, nextKey) {
  return mapKeys(obj, (_, key) => (key === prevKey ? nextKey : key))
}
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
        };
    }
924855
function unflatten (object) {
  let result = {}

  for (let key in object) {
    _set(result, key, object[key])
  }

  return result
}
673809
function(obj, key, value, index) {
		// extract values after index position
		var temp = {};
		if (index === undefined) index = 0;

		var i = 0;
		for (var thisKey in obj) {
			if (i >= index) {
				temp[thisKey] = obj[thisKey];
				delete obj[thisKey];
			}
			i++;
		}

		// insert new key/value
		obj[key] = value;

		// return values back to obj
		for (thisKey in temp) {
			obj[thisKey] = temp[thisKey];
		}

		// done
		return obj;
	}
811163
public static void rename(ObjectNode obj, String oldFieldName, String newFieldName) {
		if (obj != null && isNotBlank(oldFieldName) && isNotBlank(newFieldName)) {
			JsonNode node = remove(obj, oldFieldName);
			if (node != null) {
				obj.set(newFieldName, node);
			}
		}
	}
118451
def change_numbering(self, rename_dict, inplace=False):
        
        output = self if inplace else self.copy()
        new_index = [rename_dict.get(key, key) for key in self.index]
        output.index = new_index
        if not inplace:
            return output
892571
function (mapName, object) {
            var mapValue = this.mapValues[object.id][mapName],
                index = this.maps[mapName][mapValue].indexOf(object);

            if (index !== -1) {
                this.maps[mapName][mapValue].splice(index, 1);
            }

            return this;
        }
1091979
function(obj, key) {
		var value;
		for (var i = 2; i < arguments.length; i++) {
			value = arguments[i];
			if (value !== undefined) {
				obj[key] = value;
				break;
			}
		}

		if (value === undefined) delete obj[key];

		return obj;
	}
30934
function flip(obj) {
  var result = {};
  var keys = Object.keys(obj);
  var len = keys.length;
  for (var i = 0; i < len; i++) {
    var key = keys[i];
    result[obj[key]] = key;
  }
  return result;
}
1106002
function renameKey(fp, opts) {
  if (opts && opts.renameKey) {
    return opts.renameKey(fp, opts);
  }
  return basename(fp);
}
279422
function (key, obj) {
    //Split key
    var p = key.split('.');
    //Loop and save object state
    for (var i = 0, len = p.length; i < len - 1; i++) {
      obj = obj[p[i]];
    }
    //Return object value
    return obj[p[len - 1]];
  }
782856
def rename_property(self, old, new):
        """"""
        self._properties.replace(old, new)
        pairs = self._pairs
        pairs |= {(o, new) for o in self._objects
            if (o, old) in pairs and not pairs.remove((o, old))}
359112
function propReplace(obj, prop, value) {
    var o = {};
    for (var p in obj) {
        if (o.hasOwnProperty.call(obj, p)) {
            if (typeof obj[p] == 'object' && !Array.isArray(obj[p])) {
                propReplace(obj[p], prop, value);
            } else if (p == prop) {
                obj[p] = value;
            }
        }
    }
}
176187
function(ob,keysToCopy,copyNullEtc) {
	var k = '',
		r = {};
	for (k in ob) {
		if (
			ob.hasOwnProperty(k) &&
			(
				(keysToCopy === undefined) ||
				(keysToCopy.indexOf(k) > -1)
			)
		) {
			if (copyNullEtc || ((ob[k] !== null) && (ob[k] !== undefined))) {
				r[k] = ob[k];
			}
		}
	}
	return r;
}
1371736
function move_up(object, upside, new_name)
{
	let prefix

	if (upside)
	{
		upside[new_name] = object
		prefix = `${new_name}_`
	}
	else
	{
		upside = object
		prefix = ''
	}

	for (let key of Object.keys(object))
	{
		const child_object = object[key]

		if (is_object(child_object) && !is_pseudo_class(key) && !is_media_query(key))
		{
			delete object[key]
			move_up(child_object, upside, `${prefix}${key}`)
		}
	}
}
1036817
function withKeys(obj, keyList) {
    var retObject = {};
    var index, ptr;

    if (typeof obj != "object") {
        return retObject;
    }

    if (typeof keyList != "object"
        || !keyList.hasOwnProperty("length")
        || keyList.length <= 0) {
        return obj;
    }

    for (index in obj) {
        if (obj.hasOwnProperty(index)) {
            ptr = keyList.indexOf(index);
            if (ptr >= 0) {
                retObject[index] = obj[index];
            }
        }
    }

    return retObject;
}
4347
function replaceObject(dryReplacer, value, chain, flags, is_wrap, holder, path, value_paths, key) {

	var class_name,
	    seen_path,
	    new_value,
	    replaced,
	    is_array,
	    keys,
	    last,
	    temp,
	    len,
	    i;

	if (typeof value.constructor == 'function') {
		class_name = value.constructor.name;
	} else {
		class_name = 'Object';
	}

	// See if the chain needs popping
	while (len = chain.length) {

		// If the current object at the end of the chain does not
		// match the current holder, move one up
		// Don't mess with the chain if this is a wrap object
		if (!is_wrap && holder !== chain[len-1]) {

			last = chain.pop();

			// Only pop the path if the popped object isn't a wrapper
			if (last && !last.__is_wrap) {
				path.pop();
			}
		} else {
			break;
		}
	}

	// Has the object been seen before?
	seen_path = value_paths.get(value);

	if (seen_path) {

		// If the path is still an array,
		// turn it into a string now
		if (typeof seen_path != 'string') {

			// First iterate over the pieces and escape them
			for (i = 0; i < seen_path.length; i++) {
				if (seen_path[i].indexOf(special_char) > -1) {
					seen_path[i] = seen_path[i].replace(special_char_rg, safe_special_char);
				}
			}

			seen_path = special_char + seen_path.join(special_char);
			value_paths.set(value, seen_path);
		}

		// Replace the value with the path
		new_value = seen_path;

		// See if the new path is shorter
		len = 1;
		for (i = 0; i < path.length; i++) {
			len += 1 + path[i].length;
		}
		len += key.length;

		if (len < seen_path.length) {
			temp = seen_path;
			seen_path = path.slice(0);

			// The key of the current value still needs to be added
			seen_path.push(key);

			// First iterate over the pieces and escape them
			for (i = 0; i < seen_path.length; i++) {
				if (seen_path[i].indexOf(special_char) > -1) {
					seen_path[i] = seen_path[i].replace(special_char_rg, safe_special_char);
				}
			}

			seen_path = special_char + seen_path.join(special_char);
			value_paths.set(value, seen_path);

			// This entry still has to refer to the longer path,
			// otherwise it'll refer to itself
			seen_path = temp;
		}

		value = new_value;

		return value;
	}

	if (!flags.is_root && !is_wrap) {
		path.push(key);
	} else {
		flags.is_root = false;
	}

	// Make a copy of the current path array
	value_paths.set(value, path.slice(0));

	if (driers[class_name] != null) {
		value = driers[class_name].fnc(holder, key, value);

		value = {
			dry: class_name,
			value: value
		};

		if (driers[class_name].options.add_path !== false) {
			value.drypath = path.slice(0);
		}

		replaced = {'': value};
	} else if (class_name === 'RegExp' && value.constructor == RegExp) {
		value = {dry: 'regexp', value: value.toString()};
		replaced = {'': value};
	} else if (class_name === 'Date' && value.constructor == Date) {
		value = {dry: 'date', value: value.toISOString()};
		replaced = {'': value};
	} else if (typeof value.toDry === 'function') {
		temp = value;
		value = value.toDry();

		// If no path was supplied in the toDry,
		// get some more class information
		if (!value.path) {
			if (temp.constructor) {
				if (!value.namespace && temp.constructor.namespace) {
					value.namespace = temp.constructor.namespace;
				}

				if (!value.dry_class) {
					value.dry_class = temp.constructor.name;
				}
			}
		}

		value.dry = 'toDry';
		value.drypath = path.slice(0);
		replaced = {'': value};
	} else if (typeof value.toJSON === 'function') {
		value = value.toJSON();
		replaced = {'': value};
	} else {
		is_array = Array.isArray(value);
	}

	if (replaced) {
		// Push the replaced object on the chain
		chain.push(replaced);

		// Jsonify the replaced object
		value = dryReplacer(replaced, false, replaced['']);

		// At least one part of the path & chain will have
		// to be popped off. This is needed for toJSON calls
		// that return primitive values
		temp = chain.pop();

		// Don't pop off anything from the path if the last item
		// from the chain was a wrapper for an object,
		// because then it'll already be popped of
		if (!(temp && temp.__is_wrap && temp.__is_object)) {
			path.pop();
		}

		// Break out of the switch
		return value;
	}

	// Push this object on the chain
	chain.push(value);

	if (is_array) {
		new_value = [];

		for (i = 0; i < value.length; i++) {
			new_value[i] = dryReplacer(value, String(i), value[i]);
		}
	} else {
		new_value = recurseGeneralObject(dryReplacer, value);
	}

	value = new_value;

	return value;
}