MCPcopy Index your code
hub / github.com/marijnh/Eloquent-JavaScript / parseStack

Function parseStack

src/client/sandbox.mjs:4–14  ·  view source on GitHub ↗
(stack)

Source from the content-addressed store, hash-verified

2import * as walk from "acorn-walk"
3
4function parseStack(stack) {
5 let found = [], m
6 let re = /([\w$]*)@(.*?):(\d+)|\bat (?:([^\s(]+) \()?(.*?):(\d+)/g
7 while (m = re.exec(stack)) {
8 let fn = m[1] || m[4] || null
9 let file = m[2] || m[5] || null
10 if (fn && /sandbox/i.test(fn)) break
11 found.push({fn, file, line: m[3] || m[6]})
12 }
13 return found
14}
15function frameString(frame) {
16 return "line " + frame.line + (frame.fn ? " in function " + frame.fn : "")
17}

Callers 1

errorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected