Revision: 11882
Updated Code
at April 19, 2009 23:58 by Sephr
Updated Code
function getFunctionName(func) { if ( typeof func == "function" || typeof func == "object" ) var fName = (""+func).match( /function\s*([\w\$]*)\s*\(/ ); if ( fName !== null ) return fName[1]; }
Revision: 11881
Updated Code
at February 25, 2009 15:18 by Sephr
Updated Code
function getFunctionName(func) { if ( typeof func == "function" || typeof func == "object" ) var fName = (""+func).match( /^function\s*([\w\$]*)\s*\(/ ); if ( fName !== null ) return fName[1]; }
Revision: 11880
Updated Code
at February 24, 2009 15:19 by Sephr
Updated Code
function getFunctionName(func) { if ( typeof func == "function" || (typeof func == "object" && !( RegExp((""+func).replace(RegExp("[.*+?|()\\[\\]{}\\\\]", "g"), "\\$&"))).test(""+func.toString)) ) var fName = (""+func).match( /^function\s*([\w$]*)\s*\(/ ); if ( fName !== null ) return fName][1]; };
Revision: 11879
Updated Code
at February 24, 2009 15:14 by Sephr
Updated Code
function getFunctionName(func) { if ( typeof func == "function" || (typeof func == "object" && !( RegExp((""+func).replace(RegExp("[.*+?|()\\[\\]{}\\\\]", "g"), "\\$&"))).test(""+func.toString)) ) var fName = (""+func).match( /^function\s*([\w$]*)\s*\(/ ); if ( fName !== null ) return fName; };
Revision: 11878
Updated Code
at February 23, 2009 15:30 by Sephr
Updated Code
function getFunctionName(func) { if ( typeof func == "function" || (typeof func == "object" && !( RegExp((""+func).replace(RegExp("[.*+?|()\\[\\]{}\\\\]", "g"), "\\$&"))).test(""+func.toString)) ) return (""+func).match( /^function\s*([\w$]*)\s*\(/ )[1]; };
Revision: 11877
Updated Code
at February 23, 2009 15:27 by Sephr
Updated Code
function getFunctionName(func) { if ( typeof func == "function" || (typeof func == "object" && !( RegExp((""+func).replace(RegExp("[.*+?|()\\[\\]{}\\\\]", "g"), "\\$&"))).test(""+func.toString)) ) return (""+func).match( /^function\s*([\w$]*)\s*\(/ )[1]; };
Revision: 11876
Updated Code
at February 23, 2009 15:18 by Sephr
Updated Code
function getFunctionName(func) { if ( typeof func == "function" || (typeof func == "object" && !( RegExp((function (str) { var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"); // .*+?|()[]{}\ return str.replace(specials, "\\$&"); })(""+func)).test(""+func.toString) )) ) return (""+func).match( /^function\s*([\w$]*)\s*\(/ )[1]; };
Revision: 11875
Updated Code
at February 23, 2009 15:15 by Sephr
Updated Code
function getFunctionName(func) { if ( typeof func == "function" || (typeof func == "object" && !( RegExp((function (str) { var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"); // .*+?|()[]{}\ return str.replace(specials, "\\$&"); })(""+func)).test(""+func.toString) )) ) return (""+func).match( /function\s*([\w$]*)\s*\(/ )[1]; };
Revision: 11874
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 23, 2009 00:39 by Sephr
Initial Code
function getFunctionName(func) { if ( typeof func == "function" || (typeof func == "object" && !( RegExp((function (str) { var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"); // .*+?|()[]{}\ return str.replace(specials, "\\$&"); })(""+func)).test(""+func.toString) )) ) var funcName = (""+func).match( /function\s*([\w$]*)\s*\(/ ); if ( typeof funcName[1] != "undefined" ) return funcName[1]; };
Initial URL
Initial Description
Get Function Name ============ This will only return (a string) if the object passed to getFunctionName is a function or an "object" function from IE. The function does not rely on function.name if present as it can't always be trusted. Examples: getFunctionName(function Foo(){}) == "Foo" getFunctionName(function(){}) == ""
Initial Title
Get Function Name
Initial Tags
function
Initial Language
JavaScript