Comparing version 2.3.0 to 2.3.1
@@ -52,17 +52,3 @@ /* errorex | ||
getStack(options) { | ||
if (options) { | ||
const a1 = this.stack.split(/\n/); | ||
const result = []; | ||
for (let line of a1) { | ||
const m = line.match(/[^(]\(([^:(]*)/); | ||
if (m && path.isAbsolute(m[1]) && | ||
!m[1].includes(path.sep + 'node_modules')) { | ||
if (options.relativeTo) | ||
line = line.replace(m[1], path.relative(options.relativeTo, m[1])); | ||
result.push(line); | ||
} | ||
} | ||
return result.join('\n'); | ||
} | ||
return this.stack; | ||
return ErrorEx.getStack(this, options); | ||
} | ||
@@ -109,2 +95,3 @@ | ||
* | ||
* @param {Error} err | ||
* @param {Object} [options] | ||
@@ -115,2 +102,26 @@ * @param {boolean} [options.noInternalFiles=false] | ||
*/ | ||
static getStack(err, options) { | ||
if (!options) | ||
return err.stack; | ||
const a1 = err.stack.split(/\n/); | ||
const result = []; | ||
for (let line of a1) { | ||
const m = line.match(/[^(]\(([^:(]*)/) || line.match(/at \(?([^:(]*)/); | ||
if (m && path.isAbsolute(m[1]) && | ||
!m[1].includes(path.sep + 'node_modules')) { | ||
if (options.relativeTo) | ||
line = line.replace(m[1], path.relative(options.relativeTo, m[1])); | ||
result.push(line); | ||
} | ||
} | ||
return result.join('\n'); | ||
} | ||
/** | ||
* | ||
* @param {Object} [options] | ||
* @param {boolean} [options.noInternalFiles=false] | ||
* @param {string} [options.relativeTo] | ||
* @return {Array|*} | ||
*/ | ||
static getCallStack(options) { | ||
@@ -117,0 +128,0 @@ const frames = (new ErrorEx()).getStackFrames(options); |
{ | ||
"name": "errorex", | ||
"description": "'Extensible Error Class' implementation and predefined additional error types for javascript", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"author": "Panates Ltd.", | ||
@@ -24,6 +24,6 @@ "contributors": [ | ||
"babel-eslint": "^10.0.1", | ||
"eslint": "^5.12.1", | ||
"eslint-config-google": "^0.11.0", | ||
"mocha": "^5.2.0", | ||
"nyc": "^13.1.0" | ||
"eslint": "^5.16.0", | ||
"eslint-config-google": "^0.12.0", | ||
"mocha": "^6.1.4", | ||
"nyc": "^14.0.0" | ||
}, | ||
@@ -30,0 +30,0 @@ "engines": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Possible typosquat attack
Supply chain riskThere is a package with a similar name that is downloaded much more often.
Did you mean |
---|
error-ex |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10901
242
0