Skip to content

Commit cd825bc

Browse files
authored
fix: handle empty segments in formatForGoTypeName (#1057)
1 parent f0c0bb0 commit cd825bc

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

  • src/server/templates

src/server/templates/go.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,13 @@ ${compositeTypes
102102
function formatForGoTypeName(name: string): string {
103103
return name
104104
.split(/[^a-zA-Z0-9]/)
105-
.map((word) => `${word[0].toUpperCase()}${word.slice(1)}`)
105+
.map((word) => {
106+
if (word) {
107+
return `${word[0].toUpperCase()}${word.slice(1)}`
108+
} else {
109+
return ''
110+
}
111+
})
106112
.join('')
107113
}
108114

0 commit comments

Comments
 (0)