extend method,
also used for cloning when dest is an empty object
@param   {Object}    dest
@param   {Object}    src
@parm  {Boolean}  merge    do a merge
@returns {Object}    dest
420161
function extend(dest, src, merge) {
    for(var key in src) {
      if(dest[key] !== undefined && merge) {
        continue;
      }
      dest[key] = src[key];
    }
    return dest;
  }
157546
function() {
    var options, name, src, copy, copyIsArray, clone,
      target = arguments[0] || {},
      i = 1,
      length = arguments.length,
      deep = true;

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

    for (; i < length; i++) {
      // Only deal with non-null/undefined values
      if ((options = arguments[i]) !== null) {
        // 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 && (copy.constructor == Object || (copyIsArray = (copy.constructor == Array)))) {
            if (copyIsArray) {
              copyIsArray = false;
              // Overwrite the source with a copy of the array to merge in
              clone = [];
            } else {
              clone = src && src.constructor == Object ? src : {};
            }

            // Never move original objects, clone them
            target[name] = Util.merge(clone, copy);

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

    // Return the modified object
    return target;
  }
444525
function (dest, src, recursive) {
  for (var prop in src) {
    if (recursive && dest[prop] instanceof Object && src[prop] instanceof Object) {
      dest[prop] = defaults(dest[prop], src[prop], true);
    } else if (! (prop in dest)) {
      dest[prop] = src[prop];
    }
  }

  return dest;
}
670925
public static JSONArray merge(final JSONArray src,
                                  final UnmodifiableJSONArray dest) {
        return merge(src, copy(dest));
    }
1009941
function (src, dest, content, fileObject) {
						var files = {};

						_.each(content, function (v, k) {
							var file = fileObject.orig.dest + '/' + k + '.json';

							files[file] = JSON.stringify(v);
						});

						return files;
					}
1066167
public static void copy(final Object src, final int srcPos, final Object dest, final int destPos, final int length) {
        if (Array.getLength(src) < srcPos + length) {
            throw new IllegalArgumentException("The size of src array less than " + (srcPos + length));
        }

        if (Array.getLength(dest) < destPos + length) {
            throw new IllegalArgumentException("The size of dest array less than " + (destPos + length));
        }

        System.arraycopy(src, srcPos, dest, destPos, length);
    }
727952
function copyDirAsync(src, dest) {
  if (fs.lstatSync(src).isDirectory()) {
    const files = fs.readdirSync(src);
    files.forEach((file) => {
      const curSource = path.join(src, file);
      const curDest = path.join(dest, file);
      if (fs.lstatSync(curSource).isDirectory()) {
        if (!fs.existsSync(curDest)) {
          createDir(curDest);
        }
        copyDirAsync(curSource, curDest);
      } else {
        fs.copyAsync(curSource, curDest);
      }
    });
  }
}
486081
function merge() {
  return [].slice.call(arguments).reduce(function (merged, source) {
    for (var prop in source) {
      merged[prop] = source[prop];
    }
    return merged;
  }, {});
}
1174298
function copyFile (src, dest) {
  return new Promise((resolve, reject) => {
    const read = fs.createReadStream(src);
    read.on('error', reject);
    const write = fs.createWriteStream(dest);
    write.on('error', reject);
    write.on('finish', resolve);
    read.pipe(write);
  })
}
243524
function copyFileSync(src, dest) {
  if (!fs.lstatSync(src).isFile()) {
    throw new Error(`copyFileSync expected file but got: ${src}`);
  }
  fs.writeFileSync(dest, fs.readFileSync(src));
}
97589
function merge (target, source) {
  source = source || {};
  return Object.keys(source).reduce((targetKey, key) => {
    targetKey[key] = source[key];
    return target;
  }, target);
}
973338
function(src,dest, isfile){
                //console.log('test');
                
                if (isfile){
                    grunt.file.copy(src,dest+'/'+src,{});
                    console.log('File has been created as '+dest+'/'+src);
                    return;
                }
                
                grunt.file.recurse(src, function(abspath, rootdir, subdir, filename){
                    var _ref3=(typeof subdir=='undefined'?'':(subdir+'/'));
                    grunt.file.copy(abspath,dest+'/'+src+'/'+_ref3+filename, {});
                    console.log('File has been created as '+dest+'/'+src+'/'+filename);
                });
                
            }
853881
function merge(target, options) {
  var key;
  if (!target) { target = {}; }
  if (options) {
    for (key in options) {
      if (options.hasOwnProperty(key)) {
        var targetHasIt = target.hasOwnProperty(key),
            optionsValueType = typeof options[key],
            shouldReplace = !targetHasIt || (typeof target[key] !== optionsValueType);

        if (shouldReplace) {
          target[key] = options[key];
        } else if (optionsValueType === 'object') {
          // go deep, don't care about loops here, we are simple API!:
          target[key] = merge(target[key], options[key]);
        }
      }
    }
  }

  return target;
}
107148
function update( container, src, dest ) {
  for ( var key in src ) {
    // @TODO Better handle safe defaults.
    dest[ key ] = _deTokenize( container, src[key] );
  }
}
1000584
public static JSONObject merge(JSONObject src, UnmodifiableJSONObject dest) {
        return merge(src, copy(dest));
    }
237174
public static void shallowCopyFieldState(final Object src, final Object dest) {
		if (src == null) {
			throw new IllegalArgumentException("Source for field copy cannot be null");
		}
		if (dest == null) {
			throw new IllegalArgumentException("Destination for field copy cannot be null");
		}
		if (!src.getClass().isAssignableFrom(dest.getClass())) {
			throw new IllegalArgumentException("Destination class [" + dest.getClass().getName() +
					"] must be same or subclass as source class [" + src.getClass().getName() + "]");
		}
		doWithFields(src.getClass(), new FieldCallback() {
			@Override
			public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
				makeAccessible(field);
				Object srcValue = field.get(src);
				field.set(dest, srcValue);
			}
		}, COPYABLE_FIELDS);
	}
813738
function mergeJson(original, override) {
            return _.merge(original, override, function (a, b, key, aParent, bParent) {
                if (_.isUndefined(b)) {
                    aParent[key] = undefined;
                    return;
                }
            });
        }