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

ts2uml

Package Overview
Dependencies
Maintainers
0
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts2uml - npm Package Compare versions

Comparing version 0.0.47 to 0.0.48

2

package.json
{
"name": "ts2uml",
"version": "0.0.47",
"version": "0.0.48",
"description": "typescript workflow to uml sequence",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -18,2 +18,4 @@ "use strict";

let currentMethodName = null;
let blockDepth = 0; // Track the depth of nested blocks
let gothrough = true;
// Ensure targetLineNumber is within bounds

@@ -25,2 +27,15 @@ if (targetLineNumber < 0 || targetLineNumber > lines.length) {

const line = lines[i];
// Increase or decrease block depth based on opening and closing braces
blockDepth += (line.match(/{/g) || []).length;
blockDepth -= (line.match(/}/g) || []).length;
// Skip processing if we're inside a nested block
if (blockDepth < 0) {
gothrough = false;
continue;
}
;
if (!gothrough) {
gothrough = true;
continue;
}
// Match class declaration, considering possible keywords like 'export'

@@ -30,4 +45,5 @@ const classMatch = line.match(/(?:export\s+)?(?:abstract\s+)?class\s+(\w+)/);

currentClassName = classMatch[1];
break;
break; // Stop searching once a class is found
}
// Match method or function declaration
const methodOrFunctionMatch = line.match(/(?:async\s+)?(?:function\s+)?(?:public\s+|private\s+|protected\s+|static\s+)?\*?\s*(\w+)\s*(?:\((?:[^)]*)\))\s*(?:=>)?{/);

@@ -38,3 +54,6 @@ if (!currentMethodName && methodOrFunctionMatch) {

}
// Return after processing all lines or reaching the target line
// Adjust for cases where blockDepth might not return to 0 due to unbalanced braces
if (blockDepth !== 0) {
console.warn("Warning: Unbalanced braces detected. The results might not be accurate.");
}
return { className: currentClassName, method: currentMethodName };

@@ -41,0 +60,0 @@ }

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