Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stacktracey

Package Overview
Dependencies
Maintainers
2
Versions
141
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stacktracey - npm Package Compare versions

Comparing version 1.0.34 to 1.0.35

5

package.json
{
"name": "stacktracey",
"version": "1.0.34",
"version": "1.0.35",
"description": "Parses call stacks, reads sources and meta-information.",

@@ -35,4 +35,5 @@ "main": "stacktracey",

"dependencies": {
"get-source": "*"
"get-source": "*",
"as-table": "*"
}
}

26

README.md

@@ -12,2 +12,3 @@ # StackTracey

- [x] Full sourcemap support
- [x] Pretty printing

@@ -120,2 +121,23 @@ ## What for

## Pretty printing
```javascript
const prettyPrintedString = new StackTracey ().pretty
```
It produces a nice compact table layout, supplied with source lines (if available). You can even replace the default NodeJS exception printer with this!
```
at shouldBeVisibleInStackTrace test.js:25 const shouldBeVisibleInStackTrace = () => new StackTracey ()
at it test.js:100 const stack = shouldBeVisibleInStackTrace ()
at callFn node_modules/mocha/lib/runnable.js:326 var result = fn.call(ctx);
at run node_modules/mocha/lib/runnable.js:319 callFn(this.fn);
at runTest node_modules/mocha/lib/runner.js:422 test.run(fn);
at node_modules/mocha/lib/runner.js:528 self.runTest(function(err) {
at next node_modules/mocha/lib/runner.js:342 return fn();
at node_modules/mocha/lib/runner.js:352 next(suites.pop());
at next node_modules/mocha/lib/runner.js:284 return fn();
at <anonymous> node_modules/mocha/lib/runner.js:320 next(0);
```
## Array methods

@@ -151,5 +173,1 @@

```
## See also
Check out a fullstack framework that utilizes all this magic for better error reporting: [Useless™](https://github.com/xpl/useless).

@@ -9,3 +9,4 @@ "use strict";

getSource = require ('get-source'),
partition = require ('./impl/partition')
partition = require ('./impl/partition'),
asTable = require ('as-table')

@@ -167,2 +168,10 @@ /* ------------------------------------------------------------------------ */

}
get pretty () {
return asTable (this.withSources.map (
e => [ ('at ' + e.calleeShort.slice (0, 30)),
(e.fileShort && (e.fileShort + ':' + e.line)) || '',
((e.sourceLine || '').trim () || '').slice (0, 80) ]))
}
}

@@ -169,0 +178,0 @@

@@ -155,2 +155,9 @@ "use strict";

})
it ('pretty printing works', function prettyTest () {
const pretty = new StackTracey ().clean.pretty
pretty.split ('\n')[0].should.equal ('at prettyTest test.js:158 console.log (new StackTracey ().clean.pretty)')
})
})

@@ -157,0 +164,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc