Skip to content

Commit

Permalink
fix: file level structs and enums not being hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
naddison36 committed Aug 12, 2021
1 parent e76b808 commit 2840fc3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 8 deletions.
6 changes: 5 additions & 1 deletion lib/converter.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions lib/dotGenerator.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sol2uml",
"version": "1.1.29",
"version": "1.1.30",
"description": "Unified Modeling Language (UML) class diagram generator for Solidity contracts",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
Expand Down
6 changes: 5 additions & 1 deletion src/ts/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,11 @@ function addAssociationToDot(
(sourceUmlClass.stereotype === ClassStereotype.Library ||
targetUmlClass.stereotype === ClassStereotype.Library)) ||
(classOptions.hideInterfaces &&
targetUmlClass.stereotype === ClassStereotype.Interface)
targetUmlClass.stereotype === ClassStereotype.Interface) ||
(classOptions.hideStructs &&
targetUmlClass.stereotype === ClassStereotype.Struct) ||
(classOptions.hideEnums &&
targetUmlClass.stereotype === ClassStereotype.Enum)
) {
return ''
}
Expand Down
7 changes: 5 additions & 2 deletions src/ts/dotGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ export const dotUmlClass = (
umlClass: UmlClass,
options: ClassOptions = {}
): string => {
// do not include library or interface classes if hidden
// do not include library, interface, struct or enum classes if hidden
if (
(options.hideLibraries &&
umlClass.stereotype === ClassStereotype.Library) ||
(options.hideInterfaces &&
umlClass.stereotype === ClassStereotype.Interface)
umlClass.stereotype === ClassStereotype.Interface) ||
(options.hideStructs &&
umlClass.stereotype === ClassStereotype.Struct) ||
(options.hideEnums && umlClass.stereotype === ClassStereotype.Enum)
) {
return ''
}
Expand Down

2 comments on commit 2840fc3

@ToTheHighestTopMoon
Copy link

@ToTheHighestTopMoon ToTheHighestTopMoon commented on 2840fc3 Dec 18, 2021 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ToTheHighestTopMoon
Copy link

@ToTheHighestTopMoon ToTheHighestTopMoon commented on 2840fc3 Jul 8, 2022 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.