Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
lineNumber: evalLocationParts[1],
columnNumber: evalLocationParts[2],
source: line,
isEval: true
});
}
}
if (line.indexOf("@") === -1 && line.indexOf(":") === -1) {
// Safari eval frames only have function names and nothing else
return new StackFrame({
functionName: line
});
}
const locationParts = ErrorStackParser.extractLocation(
line.replace(functionNameRegex, "")
);
return new StackFrame({
functionName,
fileName: locationParts[0],
lineNumber: locationParts[1],
columnNumber: locationParts[2],
source: line
});
}, ErrorStackParser);
};
return filtered.map(line => {
const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
const matches = line.match(functionNameRegex);
const functionName = matches && matches[1] ? matches[1] : undefined;
if (line.indexOf(" > eval") > -1) {
const regExp = / > (eval:\d+:\d+)$/;
const evalParts = regExp.exec(line);
if (evalParts) {
const evalLocationParts = ErrorStackParser.extractLocation(
evalParts[1]
);
return new StackFrame({
functionName: functionName !== undefined ? functionName : "eval",
fileName: "cell",
lineNumber: evalLocationParts[1],
columnNumber: evalLocationParts[2],
source: line,
isEval: true
});
}
}
if (line.indexOf("@") === -1 && line.indexOf(":") === -1) {
// Safari eval frames only have function names and nothing else
return new StackFrame({
if (evalParts) {
const evalLocationParts = ErrorStackParser.extractLocation(
evalParts[1]
);
return new StackFrame({
functionName: tokens[0],
fileName: "cell",
lineNumber: evalLocationParts[1],
columnNumber: evalLocationParts[2],
source: line,
isEval: true
});
}
}
const locationParts = ErrorStackParser.extractLocation(tokens.pop());
const functionName = tokens.join(" ") || undefined;
const fileName =
["eval", ""].indexOf(locationParts[0]) > -1
? undefined
: locationParts[0];
return new StackFrame({
functionName,
fileName,
lineNumber: locationParts[1],
columnNumber: locationParts[2],
source: line
});
}, ErrorStackParser);
};