util/options.js
function sanitizeOptions(userOptions) {
    userOptions = userOptions || {};

    let options = {
        index: getIndexValue(userOptions)
    }

    if(userOptions.index){
        // required to not interfere with serve-static
        delete userOptions.index;
    }

    if (typeof (userOptions.enableBrotli) !== "undefined") {        
        options.enableBrotli = !!userOptions.enableBrotli;
    }

    if (typeof (userOptions.customCompressions) === "object" ) {
        options.customCompressions = userOptions.customCompressions;
    }

    if (typeof (userOptions.orderPreference) === "object" ) {
        options.orderPreference = userOptions.orderPreference;
    }

    return options;
}
function sanitizeOptions(userOptions) {
    userOptions = userOptions || {};

    let options = {
        index: getIndexValue(userOptions)
    }

    if(userOptions.index){
        // required to not interfere with serve-static
        delete userOptions.index;
    }

    if (typeof (userOptions.enableBrotli) !== "undefined") {        
        options.enableBrotli = !!userOptions.enableBrotli;
    }

    if (typeof (userOptions.customCompressions) === "object" ) {
        options.customCompressions = userOptions.customCompressions;
    }

    if (typeof (userOptions.orderPreference) === "object" ) {
        options.orderPreference = userOptions.orderPreference;
    }

    return options;
}
function sanitizeOptions ( userOptions ) { userOptions = userOptions || { } ; let options = { index : getIndexValue ( userOptions ) } if ( userOptions . index ) { // required to not interfere with serve-static delete userOptions . index ; } if ( typeof ( userOptions . enableBrotli ) !== "undefined" ) { options . enableBrotli = ! ! userOptions . enableBrotli ; } if ( typeof ( userOptions . customCompressions ) === "object" ) { options . customCompressions = userOptions . customCompressions ; } if ( typeof ( userOptions . orderPreference ) === "object" ) { options . orderPreference = userOptions . orderPreference ; } return options ; }
Prepares the options object for later use. Strips away any options used for serve-static.
Removes problematic options from the input options object.
@param {{enableBrotli?:boolean, customCompressions?:[{encodingName:string,fileExtension:string}], indexFromEmptyFile?:boolean, index?: boolean}} userOptions
Prepares the options object for later use . Strips away any options used for serve - static . Removes problematic options from the input options object .