Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

_toSource.js 556B

1234567891011121314151617181920212223242526
  1. /** Used for built-in method references. */
  2. var funcProto = Function.prototype;
  3. /** Used to resolve the decompiled source of functions. */
  4. var funcToString = funcProto.toString;
  5. /**
  6. * Converts `func` to its source code.
  7. *
  8. * @private
  9. * @param {Function} func The function to convert.
  10. * @returns {string} Returns the source code.
  11. */
  12. function toSource(func) {
  13. if (func != null) {
  14. try {
  15. return funcToString.call(func);
  16. } catch (e) {}
  17. try {
  18. return (func + '');
  19. } catch (e) {}
  20. }
  21. return '';
  22. }
  23. module.exports = toSource;