JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 25
  • Score
    100M100P100Q50726F
  • License CC0-1.0

Generate simple framed text from a string

Package Exports

  • neat-frame

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (neat-frame) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

neat-stack

NPM version Build Status Build status Coverage Status

Make a color-coded stack trace from an error

const neatStack = require('neat-stack');
const request = require('request');

request('foo', err => console.error(neatStack(err)));

screenshot

Useful for CLI applications — stack traces are not very important for end users but needed for authors to receive meaningful bug reports.

Installation

Use npm.

npm install neat-stack

API

const neatStack = require('neat-stack');

neatStack(error)

error: Error
Return: string

It returns a refined Error#stack:

const error = new Error('Hi');

error.stack; /* => `Error: Hi
    at Object.<anonymous> (/Users/example/run.js:1:77)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:423:7)
    at startup (bootstrap_node.js:147:9)
    at bootstrap_node.js:538:3` */

neatStack(error); /* => `\u001b[31mError: Hi\u001b[2m
    at Object.<anonymous> (/Users/example/run.js:1:77)\u001b[22m\u001b[39m` */

License

Creative Commons Zero v1.0 Universal