parent
90af4763d8
commit
7112d008d0
|
@ -3,7 +3,7 @@
|
||||||
if (!Object.hasOwnProperty('name')) {
|
if (!Object.hasOwnProperty('name')) {
|
||||||
Object.defineProperty(Function.prototype, 'name', {
|
Object.defineProperty(Function.prototype, 'name', {
|
||||||
get: function() {
|
get: function() {
|
||||||
var matches = this.toString().match(/^\s*function\s*(\S*)\s*\(/);
|
var matches = this.toString().match(/^\s*function\s*((?![0-9])[a-zA-Z0-9_$]*)\s*\(/);
|
||||||
var name = matches && matches.length > 1 ? matches[1] : "";
|
var name = matches && matches.length > 1 ? matches[1] : "";
|
||||||
// For better performance only parse once, and then cache the
|
// For better performance only parse once, and then cache the
|
||||||
// result through a new accessor for repeated access.
|
// result through a new accessor for repeated access.
|
||||||
|
|
Loading…
Reference in New Issue