# stack-filter

> Cleaner and more readable stack traces for all

Latest version **1.0.1** (published 2015-11-14) · BSD-3-Clause license · 0 weekly downloads

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

## Install

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

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2015-11-14 |
| First published | 2012-11-26 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Christian Johansen |
| Maintainers | augustl, cjohansen, dominykas, dwittner |

## Links

- npm: https://www.npmjs.com/package/stack-filter
- Repository: https://github.com/busterjs/stack-filter
- Homepage: http://busterjs.org/docs/stack-filter
- Issues: https://github.com/busterjs/stack-filter/issues
- npm.io page: https://npm.io/package/stack-filter

## Recent versions

- 1.0.1 (latest) — 2015-11-14
- 1.0.0 — 2013-09-16
- 0.1.0 — 2012-11-26

## README

# stack-filter

[![Build status](https://secure.travis-ci.org/busterjs/stack-filter.png?branch=master)](http://travis-ci.org/busterjs/stack-filter)

> Cleaner and more readable stack traces for all

`stack-filter` is a tiny module that strips out unwanted elements of a stack
trace and optimizing the remaining items for readability. `stack-filter` works
in browsers (including old and rowdy ones, like IE6) and Node. It will define
itself as an AMD module if you want it to (i.e. if there's a `define` function
available).


## API

### `stackFilter(stackTrace[, cwd])`

Accepts a stack trace as a string (e.g. one obtained from `error.stack`) and
an optional working directory, and returns a pruned stack trace in the form of
an array of lines.

The `cwd` option is used to shorten paths by removing common prefixes. For
example, Buster.JS uses this option to trim down URLs like
`http://localhost:1111/sessions/0d15095714a93cd8f9a42e97b0b280fa1550a6ac/resources/lib/file.js`
to `lib/files.js`. The current working directory is optional, and may be
either a string or a regular expression.

```javascript
var stackFilter = require("stack-filter");

stackFilter.filters.push("jquery.js"); // Ignore lines from within jQuery
stackFilter(error.stack); //=> Lines, excluding any lines from within jQuery
```

### `stackFilter.filters`

This array contains all the filters. A filter may be either a string (partial
match against path) or a regular expression.

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