39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.getLocationOfFunctionCall = exports.getLocationOfSequence = void 0;
|
|
const parser_1 = require("../error-overlay/react-overlay/utils/parser");
|
|
const getLocationOfSequence = (stack) => {
|
|
if (!stack) {
|
|
return null;
|
|
}
|
|
const parsed = (0, parser_1.parseStack)(stack.split('\n'));
|
|
let i = 0;
|
|
while (i < parsed.length) {
|
|
const frame = parsed[i];
|
|
if (frame.functionName === 'apply') {
|
|
i++;
|
|
continue;
|
|
}
|
|
return frame;
|
|
}
|
|
return null;
|
|
};
|
|
exports.getLocationOfSequence = getLocationOfSequence;
|
|
const getLocationOfFunctionCall = (stack, functionName) => {
|
|
if (!stack) {
|
|
return null;
|
|
}
|
|
const parsed = (0, parser_1.parseStack)(stack.split('\n'));
|
|
let i = 0;
|
|
while (i < parsed.length) {
|
|
const frame = parsed[i];
|
|
if (frame.functionName !== functionName) {
|
|
i++;
|
|
continue;
|
|
}
|
|
return parsed[i + 1];
|
|
}
|
|
return null;
|
|
};
|
|
exports.getLocationOfFunctionCall = getLocationOfFunctionCall;
|