stuck
v1.0.0
Published
Make all values on the current stack available
Downloads
6
Maintainers
Readme
stuck
Make all values on the current stack available.
This is a debugging utility. Don’t rely on it for anything else.
It requires the Node.js Inspector API, which is available in Node.js 8 and above, and is considered experimental at the time of writing (November 2017).
Install:
npm install stuck
const stuck = require('stuck');
const stack = stuck(); // Array of stack frames.
const frame = stack[0];
console.log(`${frame.functionName} at ${frame.url}:${frame.column}:${frame.line}`);
const scopes = stack[0].scopes; // Array of scopes.
const scope = scopes[0];
console.log(scope.type); // One of: local, global, block, closure.
console.log(scope.object); // Object with scope variables as properties.
License
MIT