UI for Zipcoin Blue

_getFuncName.js 756B

1234567891011121314151617181920212223242526272829303132
  1. var realNames = require('./_realNames');
  2. /** Used for built-in method references. */
  3. var objectProto = Object.prototype;
  4. /** Used to check objects for own properties. */
  5. var hasOwnProperty = objectProto.hasOwnProperty;
  6. /**
  7. * Gets the name of `func`.
  8. *
  9. * @private
  10. * @param {Function} func The function to query.
  11. * @returns {string} Returns the function name.
  12. */
  13. function getFuncName(func) {
  14. var result = (func.name + ''),
  15. array = realNames[result],
  16. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  17. while (length--) {
  18. var data = array[length],
  19. otherFunc = data.func;
  20. if (otherFunc == null || otherFunc == func) {
  21. return data.name;
  22. }
  23. }
  24. return result;
  25. }
  26. module.exports = getFuncName;