function changeSelectedValue(select, optValue) {
    if (!isHTMLElement(select, "select")) {
        throw new TypeError("Bad argument: The given 'select' argument is not a valid HTML Select element");
    }

    if (!(isString(optValue) || isObject(optValue))) {
        throw new TypeError("Bad argument: The given 'optValue' argument is a null or undefined");
    }

    /**
     * Object equality
     * @param {HTMLOptionElement} option 
     * @param {*} obj 
     */
    const objectEq = (option, obj) => option.value === obj.value || option.text === obj.text;

    /**
     * String equality
     * @param {HTMLOptionElement} option 
     * @param {string} obj 
     */
    const stringEq = (option, value) => option.value === value;

    const eqHandler = isString(optValue) ? stringEq : objectEq;

    const { options, multiple } = select;

    for (let i = 0; i < options.length; i++) {
        let option = options[i];

        if (eqHandler(option, optValue)) {
            if (!multiple) {
                Array.from(select.selectedOptions).forEach(opt => opt.selected = false);
            }
            option.selected = true;

            return true;
        }
    }

    return false;
}
/**
 * Changes the selected option of a `<select>` element
 * @param {!HTMLSelectElement} select
 * @param {!string} optValue option value to select
 * @returns {boolean} value indicating whether the option was found and selected
 * @memberof DOM
 */
Changes the selected option of a `` element
@param {!HTMLSelectElement} select
@param {!string} optValue option value to select
@returns {boolean} value indicating whether the option was found and selected
@memberof DOM
Changes the selected option of a ` ` element @param { !HTMLSelectElement } select @param { !string } optValue option value to select @returns { boolean } value indicating whether the option was found and selected @memberof DOM
function changeSelectedValue(select, optValue) {
    if (!isHTMLElement(select, "select")) {
        throw new TypeError("Bad argument: The given 'select' argument is not a valid HTML Select element");
    }
    if (!(isString(optValue) || isObject(optValue))) {
        throw new TypeError("Bad argument: The given 'optValue' argument is a null or undefined");
    }
    const objectEq = (option, obj) => option.value === obj.value || option.text === obj.text;
    const stringEq = (option, value) => option.value === value;
    const eqHandler = isString(optValue) ? stringEq : objectEq;
    const { options, multiple } = select;
    for (let i = 0; i < options.length; i++) {
        let option = options[i];
        if (eqHandler(option, optValue)) {
            if (!multiple) {
                Array.from(select.selectedOptions).forEach(opt => opt.selected = false);
            }
            option.selected = true;
            return true;
        }
    }
    return false;
}
function changeSelectedValue ( select , optValue ) { if ( ! isHTMLElement ( select , "select" ) ) { throw new TypeError ( "Bad argument: The given 'select' argument is not a valid HTML Select element" ) ; } if ( ! ( isString ( optValue ) || isObject ( optValue ) ) ) { throw new TypeError ( "Bad argument: The given 'optValue' argument is a null or undefined" ) ; } const objectEq = ( option , obj ) => option . value === obj . value || option . text === obj . text ; const stringEq = ( option , value ) => option . value === value ; const eqHandler = isString ( optValue ) ? stringEq : objectEq ; const { options , multiple } = select ; for ( let i = 0 ; i < options . length ; i ++ ) { let option = options [ i ] ; if ( eqHandler ( option , optValue ) ) { if ( ! multiple ) { Array . from ( select . selectedOptions ) . forEach ( opt => opt . selected = false ) ; } option . selected = true ; return true ; } } return false ; }
Changes the selected option of a `<select>` element
 @param {!HTMLSelectElement} select
 @param {!string} optValue option value to select
 @returns {boolean} value indicating whether the option was found and selected
 @memberof DOM
Changes the selected option of a ` <select > ` element @param { !HTMLSelectElement } select @param { !string } optValue option value to select @returns { boolean } value indicating whether the option was found and selected @memberof DOM
/**
     * Object equality
     * @param {HTMLOptionElement} option 
     * @param {*} obj 
     */ /**
     * String equality
     * @param {HTMLOptionElement} option 
     * @param {string} obj 
     */