rafandoo / HelpDeskRplus

Found shorthand type coercions JS-0066
Anti-pattern
Minor
a year agoa year old
 61
 62			if (typeof options.expires === 'number') {
 63				var days = options.expires, t = options.expires = new Date();
 64				t.setTime(+t + days * 864e+5); 65			}
 66
 67			return (document.cookie = [
 31    }
 32
 33    function toStr(obj) {
 34        return (typeof obj == STRING) ? obj : "" + obj; 35    }
 36
 37    function hashObject(obj) {
 32   */
 33  function decimalAdjust(type, value, exp) {
 34    // If the exp is undefined or zero...
 35    if (typeof exp === 'undefined' || +exp === 0) { 36      return Math[type](value);
 37    }
 38    value = +value;
 35    if (typeof exp === 'undefined' || +exp === 0) {
 36      return Math[type](value);
 37    }
 38    value = +value; 39    exp = +exp;
 40    // If the value is not a number or the exp is not an integer...
 41    if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) {
 36      return Math[type](value);
 37    }
 38    value = +value;
 39    exp = +exp; 40    // If the value is not a number or the exp is not an integer...
 41    if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) {
 42      return NaN;