Socket
Socket
Sign inDemoInstall

@dxos/debug

Package Overview
Dependencies
Maintainers
24
Versions
3057
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dxos/debug - npm Package Compare versions

Comparing version 2.18.3 to 2.19.0

24

dist/src/stack-trace.d.ts

@@ -1,2 +0,24 @@

export declare function getStackTrace(): any;
/**
* @deprecated Use StackTrace class to support lazy evaluation.
*/
export declare function getStackTrace(): string;
/**
* Allows to capture stack-traces.
*
* Will capture the stack trace at the point where the class is created.
* Stack traces are captured lazily only when `getStack` is called.
*
* Stack traces are expesive to capture so only call getStack when you need them.
*/
export declare class StackTrace {
private _stack;
constructor();
/**
* Get stack formatted as string.
*
* @param skipFrames Number of frames to skip. By default the first frame would be the invocation of the StackTrace constructor.
* @returns
*/
getStack(skipFrames?: number): string;
}
//# sourceMappingURL=stack-trace.d.ts.map

@@ -6,12 +6,35 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getStackTrace = void 0;
exports.StackTrace = exports.getStackTrace = void 0;
/**
* @deprecated Use StackTrace class to support lazy evaluation.
*/
function getStackTrace() {
try {
throw new Error();
const stackTrace = new StackTrace();
return stackTrace.getStack();
}
exports.getStackTrace = getStackTrace;
/**
* Allows to capture stack-traces.
*
* Will capture the stack trace at the point where the class is created.
* Stack traces are captured lazily only when `getStack` is called.
*
* Stack traces are expesive to capture so only call getStack when you need them.
*/
class StackTrace {
constructor() {
this._stack = new Error();
}
catch (err) {
return err.stack.split('\n').slice(1).join('\n');
/**
* Get stack formatted as string.
*
* @param skipFrames Number of frames to skip. By default the first frame would be the invocation of the StackTrace constructor.
* @returns
*/
getStack(skipFrames = 0) {
const stack = this._stack.stack.split('\n');
return stack.slice(skipFrames + 2).join('\n');
}
}
exports.getStackTrace = getStackTrace;
exports.StackTrace = StackTrace;
//# sourceMappingURL=stack-trace.js.map

4

package.json
{
"name": "@dxos/debug",
"version": "2.18.3",
"version": "2.19.0",
"description": "Debug utilities",

@@ -31,3 +31,3 @@ "bugs": {

"devDependencies": {
"@dxos/toolchain-node-library": "2.18.3",
"@dxos/toolchain-node-library": "2.19.0",
"@types/jest": "^26.0.7"

@@ -34,0 +34,0 @@ },

@@ -5,8 +5,35 @@ //

/**
* @deprecated Use StackTrace class to support lazy evaluation.
*/
export function getStackTrace () {
try {
throw new Error();
} catch (err: any) {
return err.stack.split('\n').slice(1).join('\n');
const stackTrace = new StackTrace();
return stackTrace.getStack();
}
/**
* Allows to capture stack-traces.
*
* Will capture the stack trace at the point where the class is created.
* Stack traces are captured lazily only when `getStack` is called.
*
* Stack traces are expesive to capture so only call getStack when you need them.
*/
export class StackTrace {
private _stack: Error;
constructor () {
this._stack = new Error();
}
/**
* Get stack formatted as string.
*
* @param skipFrames Number of frames to skip. By default the first frame would be the invocation of the StackTrace constructor.
* @returns
*/
getStack (skipFrames = 0) {
const stack = this._stack.stack!.split('\n');
return stack.slice(skipFrames + 2).join('\n');
}
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc