{"name":"clean-stack","version":"5.3.0","keywords":["clean","stack","trace","traces","error","electron"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"clean-stack@5.3.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/clean-stack#readme","bugs":{"url":"https://github.com/sindresorhus/clean-stack/issues"},"dist":{"shasum":"38873af7cadb1d19aea0dd7092a27a052ac4882a","tarball":"http://registry-npm.ywwl.com/clean-stack/download/clean-stack-5.3.0.tgz","fileCount":7,"integrity":"sha512-9ngPTOhYGQqNVSfeJkYXHmF7AGWp4/nN5D/QqNQs3Dvxd1Kk/WpjHfNujKHYUQ/5CoGyOyFNoWSPk5afzP0QVg==","signatures":[{"sig":"MEUCIQDiq6lC+hLAKm6y4oWkJ55XjdS9ULWHSlCrCigBRsrvfQIgRK28tjKRW8g1L8Fiwibkw8wDoaO/ZqgVcQSvfHXauP4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9515,"size":3361,"noattachment":false,"key":"/clean-stack/-/clean-stack-5.3.0.tgz"},"type":"module","types":"./index.d.ts","browser":{"os":false},"engines":{"node":">=14.16"},"exports":"./index.js","funding":"https://github.com/sponsors/sindresorhus","gitHead":"a785e74211d946d6d64097a9a6647798ef049350","imports":{"#home-directory":{"node":"./home-directory.js","default":"./home-directory-browser.js"}},"scripts":{"test":"ava && tsd","//test":"xo && ava && tsd"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/clean-stack.git","type":"git"},"_npmVersion":"10.9.2","description":"Clean up error stack traces","directories":{},"sideEffects":false,"_nodeVersion":"20.19.5","dependencies":{"escape-string-regexp":"5.0.0"},"_hasShrinkwrap":false,"devDependencies":{"xo":"^0.52.3","ava":"^4.3.3","tsd":"^0.24.1"},"_npmOperationalInternal":{"tmp":"tmp/clean-stack_5.3.0_1757974375923_0.15897170895356494","host":"s3://npm-registry-packages-npm-production"},"readme":"# clean-stack\n\n> Clean up error stack traces\n\nRemoves the mostly unhelpful internal Node.js entries.\n\nAlso works in the browser and 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- `file:///Users/sindresorhus/dev/clean-stack/unicorn.js:2:15` → `~/dev/clean-stack/unicorn.js:2:15`\n\nWhen enabled, file URLs are converted to regular paths for better readability and IDE integration.\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":1757974376166,"_cnpm_publish_time":1757974376166,"dist-tags":{"latest":"7.0.0"}}