stack-remap

0.1.0 • Public • Published

stack-remap

Remap the stacktrace on Errors to point to the src files of your choosing

Install

$ npm install stack-remap

Use

var stackRemap = require('stack-remap');
 
// override prepareStackTrace
stackRemap.install();
 
// setup your mappings
stackRemap.add([
    {
        source: '/path/to/my/src/one.js',
        original: { line: 1, column: 0 },
        generated: { line: 5, column: 0 },
        totalLines: 80
    },
    {
        source: '/path/to/my/src/two.js',
        original: { line: 1, column: 0 },
        generated: { line: 85, column: 0 },
        totalLines: 120
    }
]);
 
// run your code and see the stack
console.log(new Error('foo'));
 
// reset mappings if desired
stackRemap.reset();
 
// stop overriding prepareStackTrace
stackRemap.uninstall();
 
// everything is back to normal
console.log(new Error('foo'));

Readme

Keywords

none

Package Sidebar

Install

npm i stack-remap

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • seebigs