☕ Dynamic code analysis for JavaScript
Iroh is a dynamic code analysis tool for JavaScript. Iroh allows to record your code flow in realtime, intercept runtime informations and manipulate program behaviour on the fly.
Dynamic analysis is in contrast to static analysis (e.g. used in Babel and ESlint). It allows to collect data which is only available at runtime. Iroh makes it possible to collect type informations of your running program, analyze it's behaviour, capture and manipulate runtime values like parameters or variables - and all this while your code is actually running!
npm install iroh
or alternatively the browser distribution from here.
You can play with some live examples here and you can clone them from here.
Below you can see an example of visualizing captured runtime data. While the code below is running, Iroh feeds us a stream of runtime informations, which we can then visualize within any kind of model. In this case we are using a simple textual model to visualize all Iroh.CALLS
(function calls) and Iroh.IF
(if statements) of the input code. The code indentation you can see in the output is automatically generated by Iroh too.
function factorial(n) {
if (n === 0) return 1;
return n * factorial(n - 1);
};
factorial(3);
call factorial ( [3] )
call factorial ( [2] )
call factorial ( [1] )
call factorial ( [0] )
if
if end
call factorial end -> [1]
call factorial end -> [1]
call factorial end -> [2]
call factorial end -> [6]
See here.