Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import ErrorStackParser from "error-stack-parser";
import StackFrame from "stackframe";
ErrorStackParser.parseV8OrIE = error => {
const filtered = error.stack
.split("\n")
.filter(
line => !!line.match(/^\s*at .*(\S+:\d+|\(native\))/m),
ErrorStackParser
);
return filtered.map(line => {
const tokens = line
.replace(/^\s+/, "")
.replace(/\(eval code/g, "(")
.split(/\s+/)
.slice(1);
if (line.indexOf("(eval ") > -1) {
const regExp = /\), (<[^>]+>:\d+:\d+)\)$/;