您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

_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;