Last change
on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
756 bytes
|
Line | |
---|
1 | var realNames = require('./_realNames');
|
---|
2 |
|
---|
3 | /** Used for built-in method references. */
|
---|
4 | var objectProto = Object.prototype;
|
---|
5 |
|
---|
6 | /** Used to check objects for own properties. */
|
---|
7 | var hasOwnProperty = objectProto.hasOwnProperty;
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * Gets the name of `func`.
|
---|
11 | *
|
---|
12 | * @private
|
---|
13 | * @param {Function} func The function to query.
|
---|
14 | * @returns {string} Returns the function name.
|
---|
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;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.