main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
754 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import realNames from './_realNames.js';
|
---|
| 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 | export default getFuncName;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.