Skip to content

Commit

Permalink
Merge pull request #7 from vitorgamer58/fix/fixes-undefined-when-fiel…
Browse files Browse the repository at this point in the history
…d-is-array

Resolve Herbsshelf array display issue
  • Loading branch information
dalssoft authored Jul 3, 2023
2 parents 642f765 + 1af4914 commit 593b721
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/entity2diagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function fieldTypeDescription(entities, type) {
return findEntityIdByName(entities, type.name)

if (Array.isArray(type)) {
return `${type.name}[]`
return `${type[0].name}[]`
}

return type.name
Expand Down
3 changes: 2 additions & 1 deletion src/entity2diagram.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('Convert entity to diagram', () => {
id: id(Number),
stringTest: field(String),
booleanTest: field(Boolean),
ArrayTest: field([String]),
arrayTest: field([String]),
isExample: () => true
})

Expand Down Expand Up @@ -47,6 +47,7 @@ describe('Convert entity to diagram', () => {
assert.match(result, /Number id/)
assert.match(result, /String stringTest/)
assert.match(result, /Boolean booleanTest/)
assert.match(result, /String\[\] arrayTest/)
assert.match(result, /isExample()/)
})

Expand Down

0 comments on commit 593b721

Please sign in to comment.