00001 var realNames = require('./_realNames'); 00002 00004 var objectProto = Object.prototype; 00005 00007 var hasOwnProperty = objectProto.hasOwnProperty; 00008 00016 function getFuncName(func) { 00017 var result = (func.name + ''), 00018 array = realNames[result], 00019 length = hasOwnProperty.call(realNames, result) ? array.length : 0; 00020 00021 while (length--) { 00022 var data = array[length], 00023 otherFunc = data.func; 00024 if (otherFunc == null || otherFunc == func) { 00025 return data.name; 00026 } 00027 } 00028 return result; 00029 } 00030 00031 module.exports = getFuncName;