perseInt

parseIntはn進数に変換してくれるナイスな関数なのですが基数は36までしか対応してくれません ><
大文字、小文字のアルファベットを識別して、62進数に対応して欲しい。<自分で作れ

window.parseInt = (function(){
	if(parseInt.toString().indexOf('[native code]') > 0){
	    var _parseInt = window.parseInt;
	    return function(num, base){
		if(base && base > 36 && base < 63){
		    if(typeof num === 'number' || typeof num === 'string'){
			var s = 0, t = 0, c = 0;
			while(num){
			    t = num[0];
			    c = t.charCodeAt();
			    t = (48 <= c && c <= 57) ? c - 48 : ((65 <= c && c <= 90) ? c - 55 : ((97 <= c && c <= 122) ? c - 61 : false));
			    if(t === false || t > base){
				return NaN;
			    }
			    s += Math.pow(base, num.length - 1) * t;
			    num = num.substr(1,num.length - 1);
			}
			return s;
		    }
		    return NaN;
		}else{
		    return _parseInt(num, base);
		}
	    }
	}else{
	    return parseInt;
	}
    })();

こんな感じ?