@remotion/studio
Version:
APIs for interacting with the Remotion Studio
39 lines (38 loc) • 1.13 kB
JavaScript
;
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;