INNER CODE UNIT · TypeScript

joinParameterArguments

org-formation/org-formation-cli · cli.ts:5

const joinParameterArguments = (argv: string[]): string[] => {
    const result = [];
    let passedFirstArg = false;
    let currentOption = '';
    for (const arg of argv) {
        const isOption = arg.startsWith('--');
        if (!passedFirstArg && !isOption) {
            result.push(arg);
            continue;
        }
        if (!passedFirstArg && isOption) {
            result.push(arg);
            passedFirstArg = true;
            continue;
        }
        if (passedFirstArg && !isOption) {
            currentOption += arg + ' ';
            continue;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…