# parse-stack

> Parses the stack property of errors. Cross-browser.

Latest version **0.1.4** (published 2016-09-08) · LGPLv3 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install parse-stack
pnpm add parse-stack
yarn add parse-stack
bun add parse-stack
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2016-09-08 |
| First published | 2013-10-09 |
| Weekly downloads | 0 |
| License | LGPLv3 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Simon Lydell |
| Maintainers | lydell |
| Keywords | parse, stack, trace, error |

## Links

- npm: https://www.npmjs.com/package/parse-stack
- Repository: https://github.com/lydell/parse-stack
- Issues: https://github.com/lydell/parse-stack/issues
- npm.io page: https://npm.io/package/parse-stack

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 0.1.4 (latest) — 2016-09-08
- 0.1.3 — 2014-09-30
- 0.1.2 — 2013-11-30
- 0.1.1 — 2013-10-10
- 0.1.0 — 2013-10-09

## README

**DEPRECATED.** Use [error-stack-parser] instead.

[error-stack-parser]: https://github.com/stacktracejs/error-stack-parser


[![Build Status](https://travis-ci.org/lydell/parse-stack.png?branch=master)](https://travis-ci.org/lydell/parse-stack)

Overview
========

Cross-browser parsing of the [`stack` property][stack] of error objects.

What it does: Parse the `stack` property into name, file path, line number and column number (if
available). Cross-browser.

What it does not: Normalize names and file paths, or account for possible browser differences in
line and column counting.

Cross-browser, eh? Exactly _how_ cross-browser is it? See [support.md](support/support.md).

[stack]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Stack


Usage
=====

```javascript
var stack
// Generally you don't need to try/catch.
try {
	stack = parseStack(errorObject)
} catch (error) {
	console.log("The format of the `stack` property is invalid or unrecognized by `parseStack`.")
}

if (stack === null) {
	console.log("The `stack` property is not supported.")
} else {
	stack.forEach(function (stackLine) {
		console.log(
			stackLine.name,
			stackLine.filepath,
			stackLine.lineNumber,
			stackLine.columnNumber
		)
	})
}
```


Installation
============

`npm install parse-stack` or `component install lydell/parse-stack`

CommonJS: `var parseStack = require("parse-stack")`

AMD and regular old browser globals: Use ./parse-stack.js


Tests
=====

Node.js: `npm test`

Browser: Open ./test/browser/index.html


License
=======

[LGPLv3](COPYING).

---
_Source: https://npm.io/package/parse-stack · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
