|
|
1 月之前 | |
|---|---|---|
| .. | ||
| LICENSE | 1 月之前 | |
| README.md | 1 月之前 | |
| package.json | 1 月之前 | |
A port of stacktracejs/error-stack-parser, rewrite with TypeScript and ES Modules.
import { parse } from 'error-stack-parser-es'
const stacktrace = parse(new Error('BOOM!'))
Refer to stacktracejs/error-stack-parser for more details.
Additionally, this fork added a lite version of the API representation for the stack frames. You can import it from error-stack-parser-es/lite. For example, line and col instead of lineNumber and columnNumber.
import { parse } from 'error-stack-parser-es/lite'
const stacktrace = parse(new Error('BOOM!'))
// [{ file: 'file.js', name: 'method', line: 1, col: 2}]
It also allows you to parse directly from a stacktrace string (which does not support Opera stacktrace format).
import { parseStack } from 'error-stack-parser-es/lite'
const stacktrace = parseStack('Error\n at method (file.js:1:2)')
// [{ file: 'file.js', name: 'method', line: 1, col: 2}]
MIT License © 2023-PRESENT Anthony Fu MIT License © 2017 Eric Wendelin