metaltest/stackparser.js

15 lines
379 B
JavaScript
Raw Normal View History

2022-12-04 23:40:07 -05:00
const stackParser = (stack) => {
const endOfLine = stack.indexOf('\n')
const title = stack.slice(0, endOfLine)
const at = stack.indexOf(' at ')
const diff = stack.slice(endOfLine + 1, at - 1)
const endOfLineAfterAt = stack.slice(at).indexOf('\n')
const where = stack.slice(at + 3, at + endOfLineAfterAt)
return { title, diff, where }
}
export { stackParser }