merge multiple functions into one
@param {...function} [f] - functions to merge
@returns {function}
183141
function functs(...f) {
    /**
     * execute all included functions
     * @param {...*} [args] - arguments passed to all included functions
     * @returns {*[]}
     */
    function functs(...args) {
        return functs.run(this, args);
    }

    if(Array.isArray(f[0])) {
        f = f[0];
    }
    
    functs._f = f.filter((f) => {
        return typeof f === 'function';
    });
    functs.add = add.bind(functs);
    functs.remove = remove.bind(functs);
    functs.run = run.bind(functs);
    return functs;
}
984335
function functionParameters(f) {
  assert(typeof f === 'function');
  var matches = functionRegex.exec(f.toString());
  if(!matches || !matches[2].length) {
    return [];
  }
  return matches[2].split(/[,\s]+/).filter(function(str) {
    return str.length;
  });
}
625686
function join(data, separators, def_separator) {
	var undefined, buf, separator, 
	    def_separator = init(def_separator, ",");
	
	foreach(data).each(function(value) {
		if(buf === undefined) {
			buf = value;
			return;
		}
		separator = separators.shift();
		buf += init(separator, def_separator) + value;
	});
	return buf;
}
149182
function merge(prev, current, next) {
  return prev
    .concat()
    .reverse()
    .concat([current], next)
}
139650
private Function getMergedByAND(List<Function> list) {
		Iterator<Function> iterAND = list.iterator();
		Function mergedConditions = iterAND.next();
		while (iterAND.hasNext()) {
			Function e = iterAND.next();
			mergedConditions = termFactory.getFunctionAND(e, mergedConditions);
		}		
		return mergedConditions;
	}
201429
function mergeObjects(a, b) {
    var r = { };
    for (var k in a)
        r[k] = a[k];
    for (var k in b)
        r[k] = b[k];
    return r;
}
968930
function merge (target, src) {
        var dst = {};

        if (target && typeof target === 'object') {
            Object.keys(target).forEach(function (key) {
                dst[key] = target[key];
            });
        }
        Object.keys(src).forEach(function (key) {
            if (typeof src[key] !== 'object' || !src[key]) {
                dst[key] = src[key];
            } else {
                if (!target[key]) {
                    dst[key] = src[key];
                } else {
                    dst[key] = merge(target[key], src[key]);
                }
            }
        });

        return dst;
    }
948222
function flow (functions) {
  if (!functions.length) {
    return function (arg) { return arg }
  }

  return function () {
    var result = functions[0].apply(this, arguments)
    for (var i = 1; i < functions.length; i++) {
      result = functions[i](result)
    }
    return result
  }
}
1043119
private <T> T processFunction(SplitFunction<T> function) {
		synchronized (splits) {
			if (splits.isEmpty()) {
				return null;
			}
			for (Split split : splits) {
				function.evaluate(split);
			}
			return function.result();
		}
	}
760565
function mergeArray(a, b) {
  var adds = [];
  var ai = 0;

  for (var i = 0; i < b.length; i++) {
    if (('object' === type(a[i]) && 'object' === type(b[i]))
    ||  ('array' === type(a[i]) && 'array' === type(b[i]))) {
      a[i] = merge(a[i], b[i]);
    } else if ('object' === type(b[i])) {
      adds.push(merge({}, b[i]));
    } else if ('array' === type(b[i])) {
      adds.push(merge([], b[i]));
    } else if (!~a.indexOf(b[i])) {
      adds.push(b[i]);
    }
  }

  for (; ai < adds.length; ai++) {
    a.push(adds[ai]);
  }

  return a;
}
258024
function mergeOne(dst, src) {
  if (src === undefined) return dst;

  // According to specification arrays must be concatenated.
  // Also, the '.concat' creates a new array instance. Overrides the 'dst'.
  if (isArray(src)) return (isArray(dst) ? dst : []).concat(src);

  // Now deal with non plain 'src' object. 'src' overrides 'dst'
  // Note that functions are also assigned! We do not deep merge functions.
  if (!isPlainObject(src)) return src;

  // See if 'dst' is allowed to be mutated.
  // If not - it's overridden with a new plain object.
  var returnValue = isObject(dst) ? dst : {};

  var keys = Object.keys(src);
  for (var i = 0; i < keys.length; i += 1) {
    var key = keys[i];

    var srcValue = src[key];
    // Do not merge properties with the 'undefined' value.
    if (srcValue !== undefined) {
      var dstValue = returnValue[key];
      // Recursive calls to mergeOne() must allow only plain objects or arrays in dst
      var newDst = isPlainObject(dstValue) || isArray(srcValue) ? dstValue : {};

      // deep merge each property. Recursion!
      returnValue[key] = mergeOne(newDst, srcValue);
    }
  }

  return returnValue;
}
91648
function mergeSort(arr) {

  /* merges two sorted arrays into one sorted array */
  function merge(a, b) {

    /* result set */
    var c = [];

    /* as long as there are elements in the arrays to be merged */
    while (a.length > 0 || b.length > 0) {

      /* are there elements to be merged, if yes, compare them and merge */
      var n = a.length > 0 && b.length > 0 ? a[0] < b[0] ? a.shift() : b.shift() : b.length > 0 ? b.shift() : a.length > 0 ? a.shift() : null;

      /* always push the smaller one onto the result set */
      if (n !== null) {
        c.push(n);
      }
    }
    return c;
  }

  /* this mergeSort implementation cuts the array in half, wich should be fine with randomized arrays, but introduces the risk of a worst-case scenario */
  median = Math.floor(arr.length / 2);
  var part1 = arr.slice(0, median); /* for some reason it doesn't work if inserted directly in the return statement (tried so with firefox) */
  var part2 = arr.slice(median - arr.length);
  return arr.length <= 1 ? arr : merge(mergeSort(part1), /* first half */
  mergeSort(part2) /* second half */
  );
}
310715
function(into, from) {
  for (var key in from) {
    if (into[key] instanceof Object &&
        !(into[key] instanceof Array) &&
        !(into[key] instanceof Function)) {
      merge_(into[key], from[key]);
    } else {
      into[key] = from[key];
    }
  }
  return into;
}
1037608
function merge(source, target) {
    if (target == null) {
        return clone(source);
    }
    if (source == null) {
        return clone(target);
    }
    if (typeof source !== 'object' || typeof target !== 'object') {
        return clone(target);
    }
    const merge = (source, target) => {
        Object.keys(target).forEach(key => {
            if (source[key] == null) {
                source[key] = target[key];
            } else if (typeof source[key] === 'object') {
                if (typeof target[key] === 'object') {
                    merge(source[key], target[key]);
                } else {
                    source[key] = target[key];
                }
            } else {
                source[key] = target[key];
            }
        });

        return source;
    };

    return merge(clone(source), clone(target));
}
529662
function mergeArrays (a, b) {
    // if target is array then add b to array otherwise return undefined
    // so normal _.merge will be performed
    return Array.isArray(a) ? a.concat(b) : undefined
}
1330359
function merge (a, b) {
  for (var k in b)
    a[k] = a[k] || b[k]
}
989257
function () { var adds = function (a, b) {
                                    return function (x, y) { return [x + a, y + b] } }
        return [
            __(123).assert (123),
            __(Promise.resolve (123)).assert (123),
            __(function () { return 123 }).assert (123),
            __(function () { throw 123 }).assertRejected (123),
            __(adds ('foo', 'bar'), 123, 456).assert (['123foo', '456bar']) ] }