{"name":"clean-stack","version":"4.0.0","description":"Clean up error stack traces","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/clean-stack.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":">=12"},"scripts":{"test":"xo && ava && tsd"},"keywords":["clean","stack","trace","traces","error","electron"],"dependencies":{"escape-string-regexp":"5.0.0"},"devDependencies":{"ava":"^3.15.0","tsd":"^0.14.0","xo":"^0.38.2"},"browser":{"os":false},"gitHead":"aec2a0d0b95055eda9f0ffb0bbdb33803f140dbe","bugs":{"url":"https://github.com/sindresorhus/clean-stack/issues"},"homepage":"https://github.com/sindresorhus/clean-stack#readme","_id":"clean-stack@4.0.0","_nodeVersion":"12.22.1","_npmVersion":"6.14.10","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-MonulJftObGAfadTeQ1Do359xzN6cLyQRIYrdhvhHkrIg7xRrg2fiML443Q1ANke3ANu1GB3XkROVX6ili2uog==","shasum":"33272018b8a76e80c6f9b1162687b402f7c11b71","tarball":"http://registry-npm.ywwl.com/clean-stack/download/clean-stack-4.0.0.tgz","fileCount":5,"unpackedSize":6187,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgexRRCRA9TVsSAnZWagAAygkP/iG3r8b9M+g8A5dstXBx\n3/vEm+Xx0qefRkj3S5+AOegu7yCsO+SOSAkncceopXv4N7qil5KJxOYqWmyC\n+Myaz6IA3RbKyN4iNFCwwX3lpR4sjG6IiVbJIUQXycPLIMLnmC190s9QOTII\nt/EOkOiD/hyaZMXx+8a3deRQRKG6AdfnrL6QMgd32CeoRQ778/fbWjTKQvIr\nZPRxj7yucMisEbmt1NZJwJGDJfn74s+gcfACVPb65IgsCkVtGdn0snlvvPL9\nIXI20Rb/sMqjkJwvxdlYorgt+PhzIZbzd7iDVWr+06FxmzbYjyGkZyxMvv9y\no0q7I+jnwVd+8HtELd0y2kM6fsSCp/wz27NKbHEMwy7L93uGPUsROpzRPAr+\nIvj5z0ah5FWPWrTeuiG9i4cIXeryys3Dhym0fH6+laKELAXXlch6ZKPaZvY+\nb7BMJiLhi1iDER+ENtdI3Kaj8G1XAqO6RC9qccXlfXdxa7rwxOb955RtmFs0\n4MqiQZj0Q95kFXXkCX2oT4xPX60VIUWACY1TUhnp+B/qVuf62IgZwUFwq8dG\nhuM2SuiKl/tm6NZ8rB8rJ0RR2I7FhmQx1Hq4xAylECVkWGHKQP9QX8ISnizZ\nmWklBnqGUAyRphAkyR3jzLeGT/7onO+ORBhytr/F1uom02+AAQjuNggZFtPA\nh3Ln\r\n=O9UO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID7Tnr36+uu8qgHrjOn3Tn+A+mox3hkLidDYGMbByEkxAiEAwFL8up/MWZJpqxc/H5XQlm2zfLWOLztIal8japMLaRY="}],"size":2588,"noattachment":false,"key":"/clean-stack/-/clean-stack-4.0.0.tgz"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/clean-stack_4.0.0_1618678864477_0.1410655440115256"},"_hasShrinkwrap":false,"readme":"# clean-stack\n\n> Clean up error stack traces\n\nRemoves the mostly unhelpful internal Node.js entries.\n\nAlso works in Electron.\n\n## Install\n\n```sh\nnpm install clean-stack\n```\n\n## Usage\n\n```js\nimport cleanStack from 'clean-stack';\n\nconst error = new Error('Missing unicorn');\n\nconsole.log(error.stack);\n/*\nError: Missing unicorn\n    at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)\n    at Module._compile (module.js:409:26)\n    at Object.Module._extensions..js (module.js:416:10)\n    at Module.load (module.js:343:32)\n    at Function.Module._load (module.js:300:12)\n    at Function.Module.runMain (module.js:441:10)\n    at startup (node.js:139:18)\n*/\n\nconsole.log(cleanStack(error.stack));\n/*\nError: Missing unicorn\n    at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)\n*/\n```\n\n## API\n\n### cleanStack(stack, options?)\n\nReturns the cleaned stack or `undefined` if the given `stack` is `undefined`.\n\n#### stack\n\nType: `string | undefined`\n\nThe `stack` property of an [`Error`](https://github.com/microsoft/TypeScript/blob/eac073894b172ec719ca7f28b0b94fc6e6e7d4cf/lib/lib.es5.d.ts#L972-L976).\n\n#### options\n\nType: `object`\n\n##### pretty\n\nType: `boolean`\\\nDefault: `false`\n\nPrettify the file paths in the stack:\n\n`/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15` → `~/dev/clean-stack/unicorn.js:2:15`\n\n##### basePath\n\nType: `string?`\n\nRemove the given base path from stack trace file paths, effectively turning absolute paths into relative ones. It will also transform absolute file URLs into relative paths.\n\nExample with `'/Users/sindresorhus/dev/clean-stack'` as `basePath`:\n\n`/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15` → `unicorn.js:2:15`\n\n##### pathFilter\n\nType: `(path: string) => boolean`\n\nRemove the stack lines where the given function returns `false`. The function receives the path part of the stack line.\n\n```js\nimport cleanStack from 'clean-stack';\n\nconst error = new Error('Missing unicorn');\n\nconsole.log(cleanStack(error.stack));\n// Error: Missing unicorn\n//     at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)\n//     at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/omit-me.js:1:16)\n\nconst pathFilter = path => !/omit-me/.test(path);\n\nconsole.log(cleanStack(error.stack, {pathFilter}));\n// Error: Missing unicorn\n//     at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)\n```\n\n## Related\n\n- [extract-stack](https://github.com/sindresorhus/extract-stack) - Extract the actual stack of an error\n- [stack-utils](https://github.com/tapjs/stack-utils) - Captures and cleans stack traces\n","publish_time":1618678864639,"_cnpm_publish_time":1618678864639,"dist-tags":{"latest":"7.0.0"}}