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

tplant

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tplant - npm Package Compare versions

Comparing version 2.3.6 to 3.0.0

4

dist/index.js

@@ -24,3 +24,3 @@ #!/usr/bin/env node

' or a directory path to a directory containing a tsconfig.json file.')
.option('-C, --compositions', 'Create not heritage compositions')
.option('-A, --associations', 'Show associations between classes with cardinalities')
.option('-I, --only-interfaces', 'Only output interfaces')

@@ -38,3 +38,3 @@ .parse(process.argv);

var plantUMLDocument = tplant_1.tplant.convertToPlant(tplant_1.tplant.generateDocumentation(matches, getCompilerOptions(tsConfigFile)), {
compositions: commander_1.default.compositions,
associations: commander_1.default.associations,
onlyInterfaces: commander_1.default.onlyInterfaces

@@ -41,0 +41,0 @@ });

export interface ICommandOptions {
compositions: boolean;
associations: boolean;
onlyInterfaces: boolean;
}

@@ -33,4 +33,5 @@ "use strict";

var FileFactory_1 = require("./Factories/FileFactory");
var COMPOSITION_LINE = '*--';
var REFERENCE_LINE = '-->';
var REGEX_ONLY_TYPE_NAMES = /\w+/g;
var REGEX_TYPE_NAMES_WITH_ARRAY = /\w+(?:\[\])?/g;
var tplant;

@@ -57,3 +58,3 @@ (function (tplant) {

if (options === void 0) { options = {
compositions: false,
associations: false,
onlyInterfaces: false

@@ -76,4 +77,4 @@ }; }

});
if (options.compositions) {
lines.push.apply(lines, createCompositions(files));
if (options.associations) {
lines.push.apply(lines, createAssociations(files));
}

@@ -84,4 +85,4 @@ lines.push('@enduml');

tplant.convertToPlant = convertToPlant;
function createCompositions(files) {
var compositions = [];
function createAssociations(files) {
var associations = [];
var mappedTypes = {};

@@ -116,3 +117,3 @@ var outputConstraints = {};

}
var returnTypes = member.returnType.match(REGEX_ONLY_TYPE_NAMES);
var returnTypes = member.returnType.match(REGEX_TYPE_NAMES_WITH_ARRAY);
if (returnTypes !== null) {

@@ -122,7 +123,13 @@ checks = checks.concat(returnTypes);

for (var _i = 0, checks_1 = checks; _i < checks_1.length; _i++) {
var allTypeName = checks_1[_i];
var key = part.name + " " + COMPOSITION_LINE + " " + allTypeName;
if (allTypeName !== part.name &&
!outputConstraints.hasOwnProperty(key) && mappedTypes.hasOwnProperty(allTypeName)) {
compositions.push(key);
var tempTypeName = checks_1[_i];
var typeName = tempTypeName;
var cardinality = '1';
if (tempTypeName.endsWith('[]')) {
cardinality = '*';
typeName = typeName.substring(0, typeName.indexOf('[]'));
}
var key = part.name + " " + REFERENCE_LINE + " \"" + cardinality + "\" " + typeName;
if (typeName !== part.name &&
!outputConstraints.hasOwnProperty(key) && mappedTypes.hasOwnProperty(typeName)) {
associations.push(key);
outputConstraints[key] = true;

@@ -134,4 +141,4 @@ }

});
return compositions;
return associations;
}
})(tplant = exports.tplant || (exports.tplant = {}));
{
"name": "tplant",
"version": "2.3.6",
"version": "3.0.0",
"description": "Typescript to PlantUML",

@@ -51,6 +51,6 @@ "keywords": [

"@types/glob": "^7.1.1",
"@types/jest": "^26.0.14",
"@types/jest": "^26.0.24",
"@types/node": "^12.0.0",
"jest": "^26.5.2",
"ts-jest": "^24.0.2",
"jest": "^27.0.6",
"ts-jest": "^27.0.3",
"tslint": "^5.16.0",

@@ -57,0 +57,0 @@ "tslint-microsoft-contrib": "^6.1.1"

@@ -38,4 +38,4 @@ # tplant

### -C, --compositions
Create not heritage compositions.
### -A, --associations
Show associations between classes with cardinalities
Example:

@@ -47,3 +47,3 @@ ```typescript

class Car {
public wheel: Wheel;
public wheel: Wheel[];
}

@@ -59,3 +59,3 @@ ```

}
Car *-- Wheel
Car --> "*" Wheel
@enduml

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