function getCalleeName() {
var fn = function() {
var index = 0,
funcName,
stack,
stackLine,
lineParts;
try {
[].undef ();
} catch (e) {
stack = e.stack.split('\n');
// find function name on top of the stack
while (!funcName && index < stack.length) {
index++;
stackLine = stack[index];
lineParts = (stackLine && stackLine.split(/\s+/)[2]) || null;
lineParts = (lineParts && lineParts.split('.')) || [];
funcName = lineParts.length && lineParts[1];
}
}
return funcName;
};
}