-
-
Notifications
You must be signed in to change notification settings - Fork 525
Remove spaces in enum names #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/swagger-2.ts
Outdated
@@ -27,7 +27,7 @@ const TYPES: { [index: string]: string } = { | |||
}; | |||
|
|||
function capitalize(str: string) { | |||
return `${str[0].toUpperCase()}${str.slice(1)}`; | |||
return `${str[0].toUpperCase()}${str.slice(1).replace(' ', '')}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it’s all the same, maybe this should go at the end of camelCase
instead? I think camelCase is expecting non-spaces anyway.
Something like .replace(/\s+/g, '')
(I think in your example, only the first space would be replaced, and then it would skip the rest—maybe).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, wait—camelCase
should be replacing spaces with capital letters. 🤔 Why is that failing for 'American Express'
?
dbc9716
to
e8965d2
Compare
Enum values can be more than one word, so replace whitespace so that enum names are valid
e8965d2
to
6e9d3c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Enum values can be more than one word, so replace whitespace so that enum names are valid