{"name":"clean-stack","version":"5.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","imports":{"#home-directory":{"node":"./home-directory.js","default":"./home-directory-browser.js"}},"types":"./index.d.ts","engines":{"node":">=14.16"},"scripts":{"test":"xo && ava && tsd"},"keywords":["clean","stack","trace","traces","error","electron"],"dependencies":{"escape-string-regexp":"5.0.0"},"devDependencies":{"ava":"^4.3.3","tsd":"^0.24.1","xo":"^0.52.3"},"browser":{"os":false},"gitHead":"938a157c217394497e208c8c53ab536748a5b11b","bugs":{"url":"https://github.com/sindresorhus/clean-stack/issues"},"homepage":"https://github.com/sindresorhus/clean-stack#readme","_id":"clean-stack@5.0.0","_nodeVersion":"14.19.3","_npmVersion":"8.3.2","dist":{"integrity":"sha512-9bZJxKb2fTtKopGD93vWEqmf3t1E0hAWsA2oWPcci4+JCf4kMCWF71bAO9/vCadqQ2vouUPbvBpUQbgVl05ucw==","shasum":"b31fcd092b45f4eb6d2f1dbd6a4494240ba3d201","tarball":"http://registry-npm.ywwl.com/clean-stack/download/clean-stack-5.0.0.tgz","fileCount":7,"unpackedSize":7145,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCK58FBYkdEqubS3tATEIHvnUfKkipLAZvoEE8A6cPU0wIhAJGHl2lREsiTj6niZEDW5SD1A3jopLHOcVtZJ+jyE9Fx"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjMq3dACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpa4BAAgaWXb+mtbL9CAEGe+ZSNPpvpfZQdmKlD9U4tE3rKMnuT6ONr\r\nG6OerZ5lfuev5H0ZSGbe61CQPVjYZAxhjdwB63ByiI3XSNKLKgIY4Ix3f/ja\r\nwI0nKd+lGh6yLqqc0H5z23mENE3CVoG4bYSJjCiBlfAjdQ7RZ6QLWYWQMb0E\r\nfa5RJUq5tj1kqcplJpWSc7i8FpiNAtiRAwnX2kRPAyhDmp9DWo800ZwBb4W2\r\nkqtdD/pOsvWUx0gAapsoew6f1DreMv3QqZBA7E0nmAmiLMAtkt4r4lbxb7G8\r\nK4MZWaX5MssIS9cI4fl6ZBypCc0nzxN2U5S2498++H0g6WkIyY4LkJ4NzlZY\r\nF7EDo4b7p+ate6MYZigzt4PfRMuo2nLxUYl1WeM1XfAvoN2OSY03J0T/tWFY\r\nLNoVXXdEuFK/ltLLKiIu4b/nXZhKtjB0pEiA7leQUb88mxjO+bn8MoazIQCD\r\nDfZVY/VM1S7ed6rmGJne5Y/8gcSs47LV/lpqDawpNk++QYrmxZU9FBdxZn0T\r\ncHcF0OP/GIsqq0uUsbm9ejtb/+kz3fBzWU+BnbyegYAGNJCaLVQbWujS42yE\r\nSMKI/MdmuNc40x2GYoDAvX7nwZmJBc/ECNVtnlj2XEbJWMwfPIHoBso2BaYE\r\nk6XkLVGInLz7JFilSadnqn8qFnRQ30al0ms=\r\n=aK8D\r\n-----END PGP SIGNATURE-----\r\n","size":2915,"noattachment":false,"key":"/clean-stack/-/clean-stack-5.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/clean-stack_5.0.0_1664265693612_0.8714586293837747"},"_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":1664265693826,"_cnpm_publish_time":1664265693826,"dist-tags":{"latest":"7.0.0"}}