UNPKG

@readable-js/core

Version:

ReadableJS is a toolkit for teachers to craft small demos that can be explored interactively.

22 lines (21 loc) 501 B
import { runCodeWithSpy } from './run-code-with-spy/run-code-with-spy'; /** * Run the code, return the callstack with information from esprima about * position of the code. * @param code * @param options */ export function generateCallStack(code, options) { let calls = []; let error = undefined; try { calls = runCodeWithSpy(code, options); } catch (e) { error = e; } return { error: error, calls: calls, }; }