rafandoo / HelpDeskRplus

Found unnecessary else blocks JS-0056
Anti-pattern
Minor
a year ago2 years old
Unnecessary 'else' after 'return'.
13        return val.replace(/(\d{3})(\d{3})(\d{3})(\d{2})/, "$1.$2.$3-$4");
14    } else if (val.length === CNPJ_LENGTH) {
15        return val.replace(/(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})/, "$1.$2.$3/$4-$5");
16    } else {17        return val;18    }19}
20
21/* Adding an event listener to the input field with the id of cpf_cnpj. When the value of the input
Unnecessary 'else' after 'return'.
 42            // Check the hashCode method really has returned a string
 43            hashCode = obj.hashCode();
 44            return (typeof hashCode == STRING) ? hashCode : hashObject(hashCode);
 45        } else { 46            return toStr(obj); 47        } 48    }
 49    
 50    function merge(o1, o2) {
138        return "%m/%d %H"; 
139    } else if (granularity >= MINUTE_MS) {
140        return "%d %H:%M";
141    } else {142        return "%H:%M:%S";143    }144}
145
146/*
167    if (str.length > 0 && str[0] === quoteChar && str[str.length - 1] === quoteChar)
168        return str.slice(1, str.length - 1);
169    else
170        return str;171};
172
173/*