Forked from jay3sh/stack-trace-without-exception.js
Last active
August 29, 2015 14:25
-
-
Save pachacamac/3c15edbb9fecf0f7b09e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function foo(args) { | |
var i, j, k; | |
// ... | |
// j acquires some interesting value | |
// Who called foo when j took this interesting value? | |
// | |
var e = new Error('dummy'); | |
var stack = e.stack.replace(/^[^\(]+?[\n$]/gm, '') | |
.replace(/^\s+at\s+/gm, '') | |
.replace(/^Object.<anonymous>\s*\(/gm, '{anonymous}()@') | |
.split('\n'); | |
console.log(stack); | |
// ... | |
// rest of the code | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment