1 | var realNames = require('./_realNames');
|
2 |
|
3 |
|
4 | var objectProto = Object.prototype;
|
5 |
|
6 |
|
7 | var hasOwnProperty = objectProto.hasOwnProperty;
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | function getFuncName(func) {
|
17 | var result = (func.name + ''),
|
18 | array = realNames[result],
|
19 | length = hasOwnProperty.call(realNames, result) ? array.length : 0;
|
20 |
|
21 | while (length--) {
|
22 | var data = array[length],
|
23 | otherFunc = data.func;
|
24 | if (otherFunc == null || otherFunc == func) {
|
25 | return data.name;
|
26 | }
|
27 | }
|
28 | return result;
|
29 | }
|
30 |
|
31 | module.exports = getFuncName;
|