stack-filter

Cleaner and more readable stack traces for all

No longer maintained; There's a modern parser: https://www.npmjs.com/package/stacktrace-js
Last updated 12 years ago by cjohansen .
Repository · Original npm · Tarball · package.json
$ npm install stack-filter 
SYNC missed versions from official npm registry.

stack-filter

Build status

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.

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.

Current Tags

  • 1.0.1                                ...           latest (9 years ago)

3 Versions

  • 1.0.1 [deprecated]           ...           9 years ago
  • 1.0.0 [deprecated]           ...           11 years ago
  • 0.1.0 [deprecated]           ...           12 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE