Expands options arguments into multiple singular arguments.

@example [-abc] becomes [-a, '-b', '-c']

@param val the value to be expanded.
@param allowValues when true short flag groups can have values.
function expandOptions(val, allowValues) {
    val = val || [];
    var trail = [];
    return val.reduce(function (a, c) {
        if (!constants_1.FLAG_SHORT.test(c) || constants_1.FLAG_COUNT.test(c))
            return a.concat(c);
        var split = c.slice(1).split('').map(function (n) { return "-" + n; });
        if (allowValues)
            return a.concat(split);
        trail = trail.concat(split); // shift to end can't have values.
        return a;
    }, []).concat(trail);
}