@tapjs/stack
Advanced tools
Comparing version 0.0.0-6 to 0.0.0-7
@@ -0,1 +1,6 @@ | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
import { CallSiteLike } from './call-site-like.js'; | ||
@@ -91,3 +96,3 @@ export { CallSiteLike, CallSiteLikeJSON } from './call-site-like.js'; | ||
export declare function captureString(limit: number): string; | ||
export declare function captureString(fn: Function | ((...a: any[]) => any)): string; | ||
export declare function captureString(fn?: Function | ((...a: any[]) => any)): string; | ||
export declare function captureString(): string; | ||
@@ -107,3 +112,3 @@ /** | ||
*/ | ||
export declare const captureError: (e: Error) => CallSiteLike[]; | ||
export declare const captureError: (e: Error | NodeJS.ErrnoException) => CallSiteLike[]; | ||
/** | ||
@@ -110,0 +115,0 @@ * Get a processed string stack corresponding to the stack trace of the Error |
@@ -245,6 +245,12 @@ "use strict"; | ||
// errors almost always have these fields | ||
const { stack = '', message = '', name = '' } = e; | ||
const { stack = '', message = '', name = '', code, } = e; | ||
const head = name && message ? `${name}: ${message}\n` : ''; | ||
const errnoHead = name && message && code ? `${name} [${code}]: ${message}` : ''; | ||
const cleanHead = !!head && stack.startsWith(head); | ||
const s = cleanHead ? stack.substring(head.length) : stack; | ||
const cleanErrnoHead = !!errnoHead && stack.startsWith(errnoHead); | ||
const s = cleanHead | ||
? stack.substring(head.length) | ||
: cleanErrnoHead | ||
? stack.substring(errnoHead.length) | ||
: stack; | ||
const cleaned = clean(s | ||
@@ -251,0 +257,0 @@ .trimEnd() |
@@ -0,1 +1,6 @@ | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
/// <reference types="node" resolution-mode="require"/> | ||
import { CallSiteLike } from './call-site-like.js'; | ||
@@ -91,3 +96,3 @@ export { CallSiteLike, CallSiteLikeJSON } from './call-site-like.js'; | ||
export declare function captureString(limit: number): string; | ||
export declare function captureString(fn: Function | ((...a: any[]) => any)): string; | ||
export declare function captureString(fn?: Function | ((...a: any[]) => any)): string; | ||
export declare function captureString(): string; | ||
@@ -107,3 +112,3 @@ /** | ||
*/ | ||
export declare const captureError: (e: Error) => CallSiteLike[]; | ||
export declare const captureError: (e: Error | NodeJS.ErrnoException) => CallSiteLike[]; | ||
/** | ||
@@ -110,0 +115,0 @@ * Get a processed string stack corresponding to the stack trace of the Error |
@@ -228,6 +228,12 @@ import { builtinModules } from 'node:module'; | ||
// errors almost always have these fields | ||
const { stack = '', message = '', name = '' } = e; | ||
const { stack = '', message = '', name = '', code, } = e; | ||
const head = name && message ? `${name}: ${message}\n` : ''; | ||
const errnoHead = name && message && code ? `${name} [${code}]: ${message}` : ''; | ||
const cleanHead = !!head && stack.startsWith(head); | ||
const s = cleanHead ? stack.substring(head.length) : stack; | ||
const cleanErrnoHead = !!errnoHead && stack.startsWith(errnoHead); | ||
const s = cleanHead | ||
? stack.substring(head.length) | ||
: cleanErrnoHead | ||
? stack.substring(errnoHead.length) | ||
: stack; | ||
const cleaned = clean(s | ||
@@ -234,0 +240,0 @@ .trimEnd() |
{ | ||
"name": "@tapjs/stack", | ||
"version": "0.0.0-6", | ||
"version": "0.0.0-7", | ||
"description": "Utility for working with stack traces", | ||
@@ -37,2 +37,3 @@ "author": "Isaac Z. Schlueter <i@izs.me> (https://blog.izs.me)", | ||
"tap": { | ||
"typecheck": false, | ||
"coverage-map": "map.js" | ||
@@ -39,0 +40,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
211410
2077