source: trip-planner-front/node_modules/clean-stack/readme.md@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.5 KB
Line 
1# clean-stack [![Build Status](https://travis-ci.org/sindresorhus/clean-stack.svg?branch=master)](https://travis-ci.org/sindresorhus/clean-stack)
2
3> Clean up error stack traces
4
5Removes the mostly unhelpful internal Node.js entries.
6
7Also works in Electron.
8
9
10## Install
11
12```
13$ npm install clean-stack
14```
15
16
17## Usage
18
19```js
20const cleanStack = require('clean-stack');
21
22const error = new Error('Missing unicorn');
23
24console.log(error.stack);
25/*
26Error: Missing unicorn
27 at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)
28 at Module._compile (module.js:409:26)
29 at Object.Module._extensions..js (module.js:416:10)
30 at Module.load (module.js:343:32)
31 at Function.Module._load (module.js:300:12)
32 at Function.Module.runMain (module.js:441:10)
33 at startup (node.js:139:18)
34*/
35
36console.log(cleanStack(error.stack));
37/*
38Error: Missing unicorn
39 at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)
40*/
41```
42
43
44## API
45
46### cleanStack(stack, [options])
47
48#### stack
49
50Type: `string`
51
52The `stack` property of an `Error`.
53
54#### options
55
56Type: `Object`
57
58##### pretty
59
60Type: `boolean`<br>
61Default: `false`
62
63Prettify the file paths in the stack:
64
65`/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15` → `~/dev/clean-stack/unicorn.js:2:15`
66
67
68## Related
69
70- [extrack-stack](https://github.com/sindresorhus/extract-stack) - Extract the actual stack of an error
71- [stack-utils](https://github.com/tapjs/stack-utils) - Captures and cleans stack traces
72
73
74## License
75
76MIT © [Sindre Sorhus](https://sindresorhus.com)
Note: See TracBrowser for help on using the repository browser.