Debian Codegraph @

node/lodash/_toSource.js

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