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