Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const fileName =
["eval", ""].indexOf(locationParts[0]) > -1
? undefined
: locationParts[0];
return new StackFrame({
functionName,
fileName,
lineNumber: locationParts[1],
columnNumber: locationParts[2],
source: line
});
}, ErrorStackParser);
};
ErrorStackParser.parseFFOrSafari = error => {
const filtered = error.stack
.split("\n")
.filter(
line => !line.match(/^(eval@)?(\[native code\])?$/),
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) {