Flatten
Takes multiple arrays and flattens to single array.
NOTE: this will NOT work for empty nested arrays
but will work for 90 plus % of cases.

@param args rest param containing multiple arrays to flatten.
499096
function flatten() {
    var arr = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        arr[_i] = arguments[_i];
    }
    var i = 0;
    var result = [];
    while (i < arr.length) {
        var itm = arr[i];
        if (is_1.isArray(itm))
            result = result.concat(flatten.apply(void 0, itm));
        else
            result = result.concat([itm]);
        i++;
    }
    return result;
}
1067961
private void parse(String[] args) {
        for (int i=0; i<args.length; i++) {
            if (opt_with_value.containsKey(args[i])) {
                String key = opt_with_value.get(args[i]);
                values.put(key, args[i+1]);
                i++;
            } else if (args[i].startsWith("-")) {
                opt_without_value.add(args[i]);
            } else {
                arglist.add(args[i]);
            }
        }
    }
75580
protected function flattenArgs(array $args, int $depth = 0) : array
    {
        $result = [];

        foreach ($args as $key => $value) {
            if (is_object($value)) {
                $result[$key] = ['object', get_class($value)];
            } elseif (is_array($value)) {
                if ($depth > $this->nestingLimit) {
                    $result[$key] = ['array', '*DEEP NESTED ARRAY*'];
                } else {
                    $result[$key] = ['array', $this->flattenArgs($value, ++$depth)];
                }
            } elseif (null === $value) {
                $result[$key] = ['null', null];
            } elseif (is_bool($value)) {
                $result[$key] = ['boolean', $value];
            } elseif (is_resource($value)) {
                $result[$key] = ['resource', get_resource_type($value)];
            } elseif ($value instanceof \__PHP_Incomplete_Class) {
                // Special case of object - is_object() will return false.
                $array = new \ArrayObject($value);
                $result[$key] = ['incomplete-object', $array['__PHP_Incomplete_Class_Name']];
            } else {
                $result[$key] = ['string', (string) $value];
            }
        }

        return $result;
    }
624916
function flattenDeep(array) {
      var length = array == null ? 0 : array.length;
      return length ? baseFlatten(array, INFINITY) : [];
    }
479990
public final void setArgs(String... args) throws CmdArgsException
    {
        try
        {
            options = new HashMap<>();
            Option opt = null;
            int index = 0;
            for (String arg : args)
            {
                if (opt != null)
                {
                    options.put(opt.name, ConvertUtility.convert(opt.cls, arg));
                    opt = null;
                }
                else
                {
                    if (map.containsKey(arg))
                    {
                        opt = map.get(arg);
                        if (opt.exclusiveGroup != null)
                        {
                            if (effectiveGroup != null && !effectiveGroup.equals(opt.exclusiveGroup))
                            {
                                throw new CmdArgsException(opt.exclusiveGroup+" mix with "+effectiveGroup, this);
                            }
                            effectiveGroup = opt.exclusiveGroup;
                        }
                    }
                    else
                    {
                        break;
                    }
                }
                index++;
            }
            // defaults
            for (Option o : map.values())
            {
                if (!o.mandatory && !options.containsKey(o.name))
                {
                    options.put(o.name, o.defValue);
                }
            }
            int len = args.length-index;
            if (hasArrayArgument)
            {
                if (len < types.size())
                {
                    throw new CmdArgsException("too few arguments", this);
                }
            }
            else
            {
                if (len != types.size())
                {
                    throw new CmdArgsException("wrong number of arguments", this);
                }
            }
            arguments = new HashMap<>();
            int arraySize = len - types.size() + 1;
            int arrayIndex = Integer.MAX_VALUE;
            Object array = null;
            Class<?> componenType = null;
            if (hasArrayArgument)
            {
                arrayIndex = types.size()-1;
                Class<?> arrayType = types.get(arrayIndex);
                componenType = arrayType.getComponentType();
                array = Array.newInstance(componenType, arraySize);
                arguments.put(names.get(arrayIndex), array);
            }
            for (int ii=0;ii<len;ii++)
            {
                if (ii < arrayIndex)
                {
                    Object value = ConvertUtility.convert(types.get(ii), args[ii+index]);
                    arguments.put(names.get(ii), value);
                }
                else
                {
                    Object value = ConvertUtility.convert(componenType, args[ii+index]);
                    Array.set(array, ii - arrayIndex, value);
                }
            }
            for (Option o : map.values())
            {
                if (o.mandatory && !options.containsKey(o.name))
                {
                    throw new CmdArgsException("mandatory option "+o.name+": "+o.description+" missing", this);
                }
            }
            if (effectiveGroup != null)
            {
                for (Option o : groups.get(effectiveGroup))
                {
                    if (o.mandatory && !options.containsKey(o.name))
                    {
                        throw new CmdArgsException(effectiveGroup+" option "+o.name+": "+o.description+" missing", this);
                    }
                }
            }
        }
        catch (Exception ex)
        {
            throw new CmdArgsException(ex, this);
        }
    }
95678
function flatten(obj) {
  var params = {};

  forEach(obj || {}, function (val, key) {
    if (val && typeof val === 'object') {
      forEach(flatten(val), function (sub_val, sub_key) {
        params[key + '.' + sub_key] = sub_val;
      });
      return;
    }

    params[key] = val;
  });

  return params;
}
594372
private static String convertArgs(String[] args)
    {
        StringBuilder result = new StringBuilder();
        for (int i = 0; i < args.length; i++)
        {
            result.append(args[i]);
            if (i < args.length - 1)
            {
                result.append(' ');
            }
        }
        return result.toString().toUpperCase();
    }
682875
public void setArgs(java.util.Collection<CodeGenNodeArg> args) {
        if (args == null) {
            this.args = null;
            return;
        }

        this.args = new java.util.ArrayList<CodeGenNodeArg>(args);
    }
841157
public void addAll(final String... args) {
        if (args != null) {
            for (String arg : args) {
                add(arg);
            }
        }
    }
84182
public static void main( String[] args)
    {
    int exitCode = 0;
    try
      {
      ReducerCommand reducer = new ReducerCommand();
      reducer.run( new Options( args));
      }
    catch( Exception e)
      {
      exitCode = 1;
      e.printStackTrace( System.err);
      }
    finally
      {
      System.exit( exitCode);
      }
    }
289021
private void flattenLists()
    {
        FastList<E> list = (FastList<E>) this.toList();
        this.lists.clear();
        this.lists.add(list);
    }
1274258
function argsToArray(args) {
    if (_.isArray(args[0]))
      return args[0];
    else if (typeof args[0] == 'string' && args[0].indexOf(',') > -1)
      return _.invoke(args[0].split(','), 'trim');
    else
      return _.toArray(args);
  }
545256
function flattenElementsAr (ar) {
  return ar.reduce((acc, el) => {
    return isArray(el) ? [ ...acc, ...el ] : [ ...acc, el ]
  }, []).filter(notNull) // null means ignore
}
1124268
@Configurable
  public void addArg(String arg)
  {
    if (_args == null)
      _args = new ArrayList<String>();
    
    _args.add(arg);
  }
414867
function mergeArgs(val) {
    var args = [];
    for (var _i = 1; _i < arguments.length; _i++) {
        args[_i - 1] = arguments[_i];
    }
    if (chek_1.isString(val))
        val = val.trim();
    if (!chek_1.isArray(val))
        val = [val];
    // flatten and remove dupes.
    return chek_1.flatten(val.concat(args))
        .sort()
        .filter(function (v, i, arr) {
        return !i || v !== arr[i - 1];
    });
}
34562
public void setArgs(final Serializable... args) {
		this.args = args == null || args.length == 0 ? null : args;
	}
684441
@SuppressWarnings(
	{ "unchecked" })
	public static <T> List<T> toList(T...args)
	{
		if(args == null || args.length ==0)
			return null;
		
		ArrayList<T> list = new ArrayList<>(args.length);
		for (T t : args)
		{
			list.add(t);
		}
		
		return list;
	}