function appendOptions(options, fromOptions) {
    function pushOption(optionName, optionValue) {
        var valueDefined = optionValue !== null && optionValue !== undefined;
        if (optionName.length === 1) {
            // simple letter option
            options.push('-' + optionName);
            if (valueDefined) {
                options.push(optionValue);
            }
        } else {
            // full option name
            options.push('--' + optionName + (valueDefined ? '=' + optionValue : ''));
        }
    }
    for (var optionName in fromOptions) {
        if (fromOptions.hasOwnProperty(optionName) && optionName !== '_') {
            var optionValue = fromOptions[optionName];
            if (Array.isArray(optionValue)) {
                // we have multiple values for the same option, let's iterate on each
                optionValue.forEach(function (iOptionValue) {
                    pushOption(optionName, iOptionValue);
                });
            } else {
                pushOption(optionName, optionValue);
            }
        }
    }
    // now append the "_" which are not "options" but args
    if (fromOptions && fromOptions._) {
        [].concat(fromOptions._).forEach(function(arg) {
           options.push(arg);
        });
    }
}
function appendOptions(options, fromOptions) {
    function pushOption(optionName, optionValue) {
        var valueDefined = optionValue !== null && optionValue !== undefined;
        if (optionName.length === 1) {
            
            options.push('-' + optionName);
            if (valueDefined) {
                options.push(optionValue);
            }
        } else {
            
            options.push('--' + optionName + (valueDefined ? '=' + optionValue : ''));
        }
    }
    for (var optionName in fromOptions) {
        if (fromOptions.hasOwnProperty(optionName) && optionName !== '_') {
            var optionValue = fromOptions[optionName];
            if (Array.isArray(optionValue)) {
                
                optionValue.forEach(function (iOptionValue) {
                    pushOption(optionName, iOptionValue);
                });
            } else {
                pushOption(optionName, optionValue);
            }
        }
    }
    
    if (fromOptions && fromOptions._) {
        [].concat(fromOptions._).forEach(function(arg) {
           options.push(arg);
        });
    }
}
function appendOptions ( options , fromOptions ) { function pushOption ( optionName , optionValue ) { var valueDefined = optionValue !== null && optionValue !== undefined ; if ( optionName . length === 1 ) { // simple letter option options . push ( '-' + optionName ) ; if ( valueDefined ) { options . push ( optionValue ) ; } } else { // full option name options . push ( '--' + optionName + ( valueDefined ? '=' + optionValue : '' ) ) ; } } for ( var optionName in fromOptions ) { if ( fromOptions . hasOwnProperty ( optionName ) && optionName !== '_' ) { var optionValue = fromOptions [ optionName ] ; if ( Array . isArray ( optionValue ) ) { // we have multiple values for the same option, let's iterate on each optionValue . forEach ( function ( iOptionValue ) { pushOption ( optionName , iOptionValue ) ; } ) ; } else { pushOption ( optionName , optionValue ) ; } } } // now append the "_" which are not "options" but args if ( fromOptions && fromOptions . _ ) { [ ] . concat ( fromOptions . _ ) . forEach ( function ( arg ) { options . push ( arg ) ; } ) ; } }
Append each option from the given <code>fromOptions</code> to the given
<code>options</code> array, flattening them to pass them later as parameters to a
sub call process.
@param {string[]} options
@param {Options} fromOptions
Append each option from the given <code > fromOptions< / code > to the given <code > options< / code > array flattening them to pass them later as parameters to a sub call process .