Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    parse-stackpublic

    This package has been deprecated

    Author message:

    Use error-stack-parser instead.

    DEPRECATED. Use error-stack-parser instead.

    Build Status

    Overview

    Cross-browser parsing of the stack property 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.

    Usage

    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.

    install

    npm i parse-stack

    Downloadsweekly downloads

    407

    version

    0.1.4

    license

    LGPLv3

    repository

    github.com

    last publish

    collaborators

    • avatar