function type(o){
var t, c, n;
if(o === null) return 'null';
if(o !== o) return 'nan';
if((t = typeof o) !== 'object') return t;
if((c = classof(o) !== 'Object')) return c;
if(o.constructor && typeof o.constructor === 'function' && (n = o.constructor.getName())){
alert('s')
return n;
}
return 'Object';
}
function classof(o){
return Object.prototype.toString.call(o).slice(8,-1);
}
Function.prototype.getName = function(){
if('name' in this) return this.name;
console.log(('name' in this));
return this.name = this.toString().match(/function\s*([^(]*)\(/)[1];
}
function Tool(){
}
var t = new Tool();
var m = function(){
}
console.log(m.constructor.name);