Deep clone a language definition (e.g. to extend it)
186059
function (o) {
      var type = Prism.util.type(o);

      switch (type) {
        case 'Object':
          var clone = {};

          for (var key in o) {
            if (o.hasOwnProperty(key)) {
              clone[key] = Prism.util.clone(o[key]);
            }
          }

          return clone;

        case 'Array':
          return o.slice();
      }

      return o;
    }
1264107
private Grammar cloneGrammarIntoNewResourceSet(final Grammar original) {
    final Resource originalResource = original.eResource();
    XtextResourceSet _xtextResourceSet = new XtextResourceSet();
    final XtextResourceSet clonedResourceSet = EcoreUtil2.<XtextResourceSet>clone(_xtextResourceSet, originalResource.getResourceSet());
    final Resource clonedResource = clonedResourceSet.getResource(originalResource.getURI(), false);
    EObject _head = IterableExtensions.<EObject>head(clonedResource.getContents());
    return ((Grammar) _head);
  }
763500
def clone(self, substitutions, commit=True, **kwargs):
        
        return self.store.clone(substitutions, **kwargs)
1354036
function extend() {
    var target = arguments[0] || {};
    var i = 1;
    var length = arguments.length;
    var deep = false;
    var options, name, src, copy, copy_is_array, clone;

    // Handle a deep copy situation
    if (typeof target === 'boolean') {
      deep = target;
      target = arguments[1] || {};
      // skip the boolean and the target
      i = 2;
    }

    // Handle case when target is a string or something (possible in deep copy)
    if (typeof target !== 'object' && !isFn(target)) {
      target = {};
    }

    for (; i < length; i++) {
      // Only deal with non-null/undefined values
      options = arguments[i];
      if (options !== null) {
        if (typeof options === 'string') {
          options = options.split('');
        }
        // Extend the base object
        for (name in options) {
          src = target[name];
          copy = options[name];

          // Prevent never-ending loop
          if (target === copy) {
            continue;
          }

          // Recurse if we're merging plain objects or arrays
          if (deep && copy && (isHash(copy) || (copy_is_array = isArray(copy)))) {
            if (copy_is_array) {
              copy_is_array = false;
              clone = src && isArray(src) ? src : [];
            } else {
              clone = src && isHash(src) ? src : {};
            }

            // Never move original objects, clone them
            target[name] = extend(deep, clone, copy);

            // Don't bring in undefined values
          } else if (typeof copy !== 'undefined') {
            target[name] = copy;
          }
        }
      }
    }

    // Return the modified object
    return target;
  }
1059787
function deepClone(o, visited) {
			var clone, id, type = _.util.type(o);
			visited = visited || {};

			switch (type) {
				case 'Object':
					id = _.util.objId(o);
					if (visited[id]) {
						return visited[id];
					}
					clone = {};
					visited[id] = clone;

					for (var key in o) {
						if (o.hasOwnProperty(key)) {
							clone[key] = deepClone(o[key], visited);
						}
					}

					return clone;

				case 'Array':
					id = _.util.objId(o);
					if (visited[id]) {
						return visited[id];
					}
					clone = [];
					visited[id] = clone;

					o.forEach(function (v, i) {
						clone[i] = deepClone(v, visited);
					});

					return clone;

				default:
					return o;
			}
		}
677268
def _clone(self, deepcopy=True):
        """"""
        clone = self._clone_base()
        values_to_clone = ("spec", "projection", "skip", "limit",
                           "max_time_ms", "max_await_time_ms", "comment",
                           "max", "min", "ordering", "explain", "hint",
                           "batch_size", "max_scan", "manipulate",
                           "query_flags", "modifiers", "collation")
        data = dict((k, v) for k, v in iteritems(self.__dict__)
                    if k.startswith('_Cursor__') and k[9:] in values_to_clone)
        if deepcopy:
            data = self._deepcopy(data)
        clone.__dict__.update(data)
        return clone
16508
function clone(source) {
    var ret = {};
    for (var prop in source) {
      ret[prop] = source[prop];
    }
    return ret;
  }
81721
function extend(...args){
	if ( !args.length || isArray(args[0]) || !args[0] ) return null;

	let keys = args[args.length-1];
	if ( !keys ) return;

	let oOrig = args[0];
	oOrig.class = classToPlantObject(oOrig.class);

	if ( isArray(keys) ) {
		for ( let i=0, oCopy; i<args.length-1; i++ ) {
			oCopy = args[i];
			if ( oOrig !== oCopy && isPlainObject(oCopy) ) {
				keys.forEach(k => {
					if ( oCopy[k] !== undefined ) {
						k == 'class' ? Object.assign(oOrig.class, classToPlantObject(oCopy[k])) : (oOrig[k] = _copyObjectValue(oCopy[k]));
					}
				});
			}
		}
	}else{
		for ( let i=1, oCopy; i<args.length; i++ ) {
			oCopy = args[i];
			if ( oOrig !== oCopy && isPlainObject(oCopy) ) {
				for ( let k in oCopy ) {
					k == 'class' ? Object.assign(oOrig.class, classToPlantObject(oCopy[k])) : (oOrig[k] = _copyObjectValue(oCopy[k]));
				}
			}
		}
	}
	return oOrig;
}
368518
function clone(value, deep) {
    if (Array.isArray(value)) {
      if (deep) {
        return value.map(function(value) {
          return clone(value, deep);
        });
      } else {
        return value.slice();
      }
    } else if (value && typeof value === 'object') {
      if (value.valueOf() !== value) {
        return new value.constructor(value.valueOf());
      } else {
        var copy = {};
        for (var key in value) {
          var objValue = value[key];
          if (deep) {
            objValue = clone(objValue, deep);
          }
          copy[key] = objValue;
        }
        return copy;
      }
    } else {
      return value;
    }
  }
91668
function cloneEvents(origin, clone, deep) {
      var listeners = origin._listeners
      if (listeners) {
        clone._listeners = listeners
        for (var type in listeners) {
          clone.addEventListener(type, listeners[type])
        }
      }
      if (deep && origin.children && origin.children.length) {
        for (var i = 0, l = origin.children.length; i < l; i++) {
          cloneEvents(origin.children[i], clone.children[i], deep)
        }
      }
    }
316941
function deepExtend(target, source) {
  _.each(source, function(value, key) {
    if (_.has(target, key) && isObject(target[key]) && isObject(source[key])) {
      deepExtend(target[key], source[key]);
    } else {
      target[key] = source[key];
    }
  });
  return target;
}
1187904
def clone(self):
    """"""
    return type(self)(name = self.name, dataFormat = self._dataFormat)
660387
function extend(o) {
  if (typeOf(o) !== 'object') { return {}; }
  var args = arguments;
  var len = args.length - 1;

  for (var i = 0; i < len; i++) {
    var obj = args[i + 1];

    if (typeOf(obj) === 'object' && typeOf(obj) !== 'regexp') {
      for (var key in obj) {
        if (obj.hasOwnProperty(key)) {
          o[key] = obj[key];
        }
      }
    }
  }
  return o;
}
1012977
def clone(orig, n):
    
    if n == 0:
        return layerize(noop())
    layers = [orig]
    for i in range(n - 1):
        layers.append(copy.deepcopy(orig))
        layers[-1].set_id()
    return FeedForward(layers)
1361977
function deepClone(inputDict){

    if (!inputDict)
        return null;

    const clonedDict = {};

    for (let key in inputDict){

        if (typeof(inputDict[key]) == 'object'){

            clonedDict[key] = deepClone(inputDict[key]);
        
        }
        else{

            clonedDict[key] = inputDict[key];

        }

    }

    return clonedDict;

}
203674
function extend(dest, source){
    for (var key in source)
      dest[key] = source[key];

    return dest;
  }
214199
function clone(candidate)
{
  var copy;

  if (typeOf(candidate) == 'array')
  {
    copy = [].concat(candidate);
  }
  else if (typeOf(candidate) == 'object')
  {
    copy = extend(candidate);
  }
  else
  {
    copy = candidate;
  }

  return copy;
}