1 |
|
2 | /**
|
3 | * Hack in support for Function.name for browsers that don't support it.
|
4 | * IE, I'm looking at you.
|
5 | **/
|
6 |
|
7 | (function () {
|
8 | if (Function.prototype.name === undefined && Object.defineProperty !== undefined) {
|
9 | Object.defineProperty(Function.prototype, 'name', {
|
10 | get: function() {
|
11 | console.log(55);
|
12 | var funcNameRegex = /function\s([^(]{1,})\(/;
|
13 | var results = (funcNameRegex).exec((this).toString());
|
14 | return (results && results.length > 1) ? results[1].trim() : "";
|
15 | },
|
16 | set: function(value) {}
|
17 | });
|
18 | }
|
19 | })();
|