Last change
on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
556 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 | module.exports = toSource;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.