{"name":"clean-stack","version":"5.2.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":"9d0c2354d4c76da921283dfe6544dbfe45e4cbcf","bugs":{"url":"https://github.com/sindresorhus/clean-stack/issues"},"homepage":"https://github.com/sindresorhus/clean-stack#readme","_id":"clean-stack@5.2.0","_nodeVersion":"14.21.3","_npmVersion":"9.2.0","dist":{"integrity":"sha512-TyUIUJgdFnCISzG5zu3291TAsE77ddchd0bepon1VVQrKLGKFED4iXFEDQ24mIPdPBbyE16PK3F8MYE1CmcBEQ==","shasum":"c7a0c91939c7caace30a3bf254e8a8ac276d1189","tarball":"http://registry-npm.ywwl.com/clean-stack/download/clean-stack-5.2.0.tgz","fileCount":7,"unpackedSize":8747,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDAXHHoTtvsjiHIZFMS4gkqtqAsDHqZlpsdJwh8Tc/xVAIge/q+NbPkZqeQXB68Di45tbD4nR51RnlM7hjK0CndxF0="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkGYgtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr3KhAAmxXtrIiVLxkJmbe/JHKt4kmF4BkUJN/b0z8VvjMR0JB1/oMr\r\ngXmCRPvLEeNMVsvoAcJy6lAgDCobdAQRVQ3gi2IyP9OzNIFI9gtNdh/omiLq\r\nCuHo2xsIXpNdrJSqnIJ06ZlneSTpNGhKwwbT6LGxddbF53pdRMnehPr1Lz6t\r\nO44/AVSJdQUr0JDe9lneOFZ1l31Lj/+VMjkIMwjSrpBvgNs+bbsZyyzwSDCn\r\n8M7Kv0Q7K/yNDEzp6ZwbuhG2qOUB522zmE74LFbeXAJNGiz69kMMH955/LoR\r\nTXBRwMi+kC2M2C4usIBKr0Bo/EQkjg6UP3AABunAcvXRN9wgUA+Tvn5L+obn\r\nZnaSTqmh24Lck1+a9bC7QcENdPD80vPz/zy+vFYHrXLVqb+HgkFqF4MugmvT\r\nYnrNNe8hvVUK92tfqr2F5UaqJf7MgypThXZBGdEsWpX8irjJhQT/UzlMZ728\r\nzlS3awlwDOInqG+Lix8zNduz8vy3VBNCEFLscG5f5dNFVgQecKpGy1djTFqn\r\nlIguX6JFYDjEwfEi6U7l1pjpPNBv4eNcrWGvYyzJh+DTfXnH9/wliyjrll3y\r\n2ZsDeD+6GOiWYjS/sw4NI+H8UnwrVn3iYJYUwF6uvLVor7cVwcKmnmd7mvW9\r\n1qIp+oEFT7D0JWvZVAxj7NNrNUAK+o24hnw=\r\n=2lAQ\r\n-----END PGP SIGNATURE-----\r\n","size":3134,"noattachment":false,"key":"/clean-stack/-/clean-stack-5.2.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.2.0_1679394861676_0.4023184983360477"},"_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":1679394861848,"_cnpm_publish_time":1679394861848,"dist-tags":{"latest":"7.0.0"}}