code: function (mixed, base) {
              var type = typeof mixed;
  
              base = base || 10;
  
              if (type === "boolean") {
                  return +mixed;
  
              } else if (type === "string") {
                  mixed   = mixed.replace(/\s/g, "");
                  var tmp = parseInt(mixed, base);
                  return (isNaN(tmp) || !isFinite(tmp)) ? 0 : tmp;
  
              } else if (type === "number" && isFinite(mixed)) {
                  /* jshint -W016 */
                  return mixed | 0;
                  /* jshint +W016 */
  
              } else {
                  return 0;
              }
          }
docs: Parse integer from string
  
  @link http://phpjs.org/functions/intval/
  
  @param mixed
  @param base
  @returns {Number}