Skip to content

Commit dbc9716

Browse files
committed
Remove spaces in enum names
Enum values can be more than one word, so replace whitespace so that enum names are valid
1 parent c6a61fe commit dbc9716

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/swagger-2.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ const TYPES: { [index: string]: string } = {
2727
};
2828

2929
function capitalize(str: string) {
30-
return `${str[0].toUpperCase()}${str.slice(1)}`;
30+
return `${str[0].toUpperCase()}${str.slice(1);
3131
}
3232
3333
function camelCase(name: string) {
34-
return name.replace(/(-|_|\.|\s)+[a-z]/g, letter =>
34+
return name.replace(/(-|_|\.|\s\W)+[a-z]/g, letter =>
3535
letter.toUpperCase().replace(/[^0-9a-z]/gi, '')
3636
);
3737
}

0 commit comments

Comments
 (0)