main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
554 bytes
|
Line | |
---|
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 | export default toSource;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.