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

backtracker

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backtracker - npm Package Compare versions

Comparing version 3.1.0 to 3.1.1

9

dist/Caller.js

@@ -7,2 +7,11 @@ "use strict";

class Caller {
path;
dir;
filename;
async;
scope;
line;
column;
anonymous;
parent;
constructor(details) {

@@ -9,0 +18,0 @@ this.path = details.path;

12

dist/index.js

@@ -5,3 +5,2 @@ "use strict";

};
const Caller_1 = __importDefault(require("./Caller"));

@@ -16,8 +15,7 @@ const Stack_1 = __importDefault(require("./Stack"));

];
class BackTracker {
parent;
constructor() {
this.parent = BackTracker.stack.first();
}
static get stack() {

@@ -30,6 +28,4 @@ const stack = new Error().stack;

}
const split = stack.split("\n");
const frames = split.slice(3, split.length).map(item => item.trim());
for (const frame of frames) {

@@ -41,3 +37,2 @@ const test1 = evalreg.exec(frame);

}
const test2 = somethingreg.exec(frame);

@@ -48,3 +43,2 @@ if (test2 && test2.length > 0) {

}
const test3 = namedreg.exec(frame);

@@ -55,3 +49,2 @@ if (test3 && test3.length > 0) {

}
const test4 = anonymousreg.exec(frame);

@@ -62,3 +55,2 @@ if (test4 && test4.length > 0) {

}
const test5 = notnamedreg.exec(frame);

@@ -69,3 +61,2 @@ if (test5 && test5.length > 0) {

}
for (const caller of callers) {

@@ -78,3 +69,2 @@ const index = callers.indexOf(caller);

}
module.exports = {

@@ -81,0 +71,0 @@ BackTracker,

declare class Stack extends Array<import("./Caller")> {
constructor();
first(amount?: number): import("./Caller") | Array<import("./Caller")>;
last(amount?: number): import("./Caller") | Array<import("./Caller")>;
first(): import("./Caller");
first(amount: number): Array<import("./Caller")>;
last(): import("./Caller");
last(amount: number): Array<import("./Caller")>;
}
export = Stack;

@@ -6,18 +6,17 @@ "use strict";

}
first(amount) {
if (!Number.isInteger(amount) || amount === 0) return this[0];
if (amount < 0) return this.last(amount * -1);
if (!amount)
return this[0];
if (amount < 0)
return this.last(amount * -1);
return this.slice(0, amount);
}
last(amount) {
if (!Number.isInteger(amount) || amount === 0) return this[this.length - 1];
if (amount < 0) return this.first(amount * -1);
if (!amount)
return this[this.length - 1];
if (amount < 0)
return this.first(amount * -1);
return this.slice(-amount);
}
}
module.exports = Stack;
{
"name": "backtracker",
"version": "3.1.0",
"version": "3.1.1",
"description": "Back track in JS code execution and find where a function was called",

@@ -26,4 +26,5 @@ "main": "dist/index",

"files": [
"dist"
"dist",
"README.md"
]
}

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