Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

error-stack2

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

error-stack2 - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

2

dist/index.d.ts

@@ -75,3 +75,3 @@ import { ITSPartialRecord, ITSPickExtra, ITSRequireAtLeastOne } from 'ts-type/lib/type/record';

};
export declare function parseMessage(body: string): IParsedWithoutTrace;
export declare function parseMessage(body: string, looseMode?: boolean): IParsedWithoutTrace;
export declare function parseStack(rawStack: string, detectMessage?: string): IParsed;

@@ -78,0 +78,0 @@ export declare function formatTrace({ callee, calleeNote, source, line, col, }: ITSPickExtra<ITrace, "source">): string;

{
"name": "error-stack2",
"version": "2.0.1",
"version": "2.0.2",
"description": "Parse and manipulate error.stack",

@@ -5,0 +5,0 @@ "keywords": [

@@ -19,2 +19,4 @@ import { ITSPickExtra, ITSRequireAtLeastOne } from 'ts-type/lib/type/record';

const REGEX_MATCH_MESSAGE_LOOSE = new RegExp(REGEX_MATCH_MESSAGE.source, REGEX_MATCH_MESSAGE.flags + 'm');
const REGEX_REMOVE_AT = /^at\s+/

@@ -229,7 +231,7 @@ const REGEX_STARTS_WITH_EVAL_AT = /^eval\s+at\s+/

{
let { type } = parseMessage(rawStack);
let { type, message } = parseMessage(rawStack, true);
let mf = formatMessage({
type,
message: detectMessage,
message: detectMessage === '' ? message : detectMessage,
});

@@ -258,3 +260,4 @@

// A error message might have multiple lines
const index = rawTrace.findIndex(line => line.trimLeft().startsWith(AT) && validTrace(parseTrace(trim(line), true)));
const index = rawTrace.findIndex(line => line.trimLeft()
.startsWith(AT) && validTrace(parseTrace(trim(line), true)));

@@ -270,7 +273,7 @@ rawMessage = [rawMessage, ...rawTrace.splice(0, index)].join(LF)

export function parseMessage(body: string): IParsedWithoutTrace
export function parseMessage(body: string, looseMode?: boolean): IParsedWithoutTrace
{
try
{
const [, type, code, message] = body.match(REGEX_MATCH_MESSAGE)
const [, type, code, message] = body.match(looseMode ? REGEX_MATCH_MESSAGE_LOOSE : REGEX_MATCH_MESSAGE);

@@ -299,3 +302,6 @@ return {

{
throw new TypeError('stack must be a string')
throw errcode(new TypeError('stack must be a string'), {
rawStack,
detectMessage,
});
}

@@ -302,0 +308,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

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