Gathering detailed insights and metrics for clean-stack
Gathering detailed insights and metrics for clean-stack
Gathering detailed insights and metrics for clean-stack
Gathering detailed insights and metrics for clean-stack
@esm2cjs/clean-stack
Clean up error stack traces. This is a fork of sindresorhus/clean-stack, but with CommonJS support.
stack-utils
Captures and cleans stack traces
clean-stacktrace
Clean up error stack traces from node internals
@artdeco/clean-stack
A utility to remove internal Node.js lines and specific modules from error stacks.
npm install clean-stack
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (97.83%)
TypeScript (2.17%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
340 Stars
53 Commits
21 Forks
7 Watchers
1 Branches
13 Contributors
Updated on Jun 12, 2025
Latest Version
5.2.0
Package Id
clean-stack@5.2.0
Unpacked Size
8.54 kB
Size
3.06 kB
File Count
7
NPM Version
9.2.0
Node Version
14.21.3
Published on
Mar 21, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
Clean up error stack traces
Removes the mostly unhelpful internal Node.js entries.
Also works in Electron.
1npm install clean-stack
1import cleanStack from 'clean-stack'; 2 3const error = new Error('Missing unicorn'); 4 5console.log(error.stack); 6/* 7Error: Missing unicorn 8 at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15) 9 at Module._compile (module.js:409:26) 10 at Object.Module._extensions..js (module.js:416:10) 11 at Module.load (module.js:343:32) 12 at Function.Module._load (module.js:300:12) 13 at Function.Module.runMain (module.js:441:10) 14 at startup (node.js:139:18) 15*/ 16 17console.log(cleanStack(error.stack)); 18/* 19Error: Missing unicorn 20 at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15) 21*/
Returns the cleaned stack or undefined
if the given stack
is undefined
.
Type: string | undefined
The stack
property of an Error
.
Type: object
Type: boolean
Default: false
Prettify the file paths in the stack:
/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15
→ ~/dev/clean-stack/unicorn.js:2:15
Type: string?
Remove 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.
Example with '/Users/sindresorhus/dev/clean-stack'
as basePath
:
/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15
→ unicorn.js:2:15
Type: (path: string) => boolean
Remove the stack lines where the given function returns false
. The function receives the path part of the stack line.
1import cleanStack from 'clean-stack'; 2 3const error = new Error('Missing unicorn'); 4 5console.log(cleanStack(error.stack)); 6// Error: Missing unicorn 7// at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15) 8// at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/omit-me.js:1:16) 9 10const pathFilter = path => !/omit-me/.test(path); 11 12console.log(cleanStack(error.stack, {pathFilter})); 13// Error: Missing unicorn 14// at Object.<anonymous> (/Users/sindresorhus/dev/clean-stack/unicorn.js:2:15)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 12/30 approved changesets -- score normalized to 4
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More