M
M
Max Yawo2016-02-12 23:19:03
JavaScript
Max Yawo, 2016-02-12 23:19:03

How to build a javascript function call tree?

I have a file with javascript code (that is, each time a new file and I don’t have the code in advance) and I need to get a sequential list of function calls from this file.
For example, I have this file:

function one() {
  //Code
}
function two() {
  //Code
  one();
}
function three() {
  //Code
  two();
  one();
}

three();

I should get something like this:
{
    "three()": 
    [
        {"two()": "one()"},
        "one()"
    ]
}

Now there are 2 ideas:
1) Analyze the code yourself.
2) Use any interpreter (but I don't know how).
Tell me which way to dig.
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey P, 2016-02-13
@ruddy22

https://www.stacktracejs.com
https://developer.mozilla.org/en-US/docs/Web/JavaS...
stackoverflow.com/questions/280389/how-do-you-find...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question