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 }