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
99.7
Supply Chain
99.4
Quality
75.9
Maintenance
100
Vulnerability
100
License
JavaScript (97.83%)
TypeScript (2.17%)
Total Downloads
5,486,620,736
Last Day
1,825,575
Last Week
32,973,430
Last Month
143,087,879
Last Year
1,513,806,170
MIT License
340 Stars
53 Commits
21 Forks
7 Watchers
1 Branches
13 Contributors
Updated on Jun 12, 2025
Minified
Minified + Gzipped
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
-10.7%
1,825,575
Compared to previous day
Last Week
-8.2%
32,973,430
Compared to previous week
Last Month
1.4%
143,087,879
Compared to previous month
Last Year
16.9%
1,513,806,170
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 dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
security policy file detected
Details
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
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
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
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-06-23
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