clean-stack
Advanced tools
Comparing version 1.0.0 to 1.1.0
19
index.js
'use strict'; | ||
module.exports = stack => stack.replace(/\s+at.*\((?:(?:internal\/)?\w+\.js:\d+:\d+|native)\)|\s+at.*(?:node|internal\/\w+)\.js:\d+:\d+/g, ''); | ||
const extractPathRegex = /\s+at.*(?:\(|\s)(.*)\)?/; | ||
const pathRegex = /^(?:(?:(?:node|(?:internal\/|.*node_modules\/babel-polyfill\/.*)?\w+)\.js:\d+:\d+)|native)/; | ||
module.exports = stack => { | ||
return stack.replace(/\\/g, '/') | ||
.split('\n') | ||
.filter(x => { | ||
const pathMatches = x.match(extractPathRegex); | ||
if (pathMatches === null || !pathMatches[1]) { | ||
return true; | ||
} | ||
return !pathRegex.test(pathMatches[1]); | ||
}) | ||
.filter(x => x.trim() !== '') | ||
.join('\n'); | ||
}; |
{ | ||
"name": "clean-stack", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Clean up error stack traces", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
3277
16
0