Skip to content

Commit

Permalink
chore: optimized code
Browse files Browse the repository at this point in the history
  • Loading branch information
phk422 committed Aug 30, 2024
1 parent 1e2e1c2 commit 7b05a55
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/openapi-typescript/src/lib/ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,9 @@ export function tsEnumMember(value: string | number, metadata: { name?: string;
if (invalidCharMatch[0] === name) {
name = `"${name}"`;
} else {
name = name.replace(JS_PROPERTY_INDEX_INVALID_CHARS_RE, (substring) => SPECIAL_CHARACTER_MAP[substring] || "_");
name = name.replace(JS_PROPERTY_INDEX_INVALID_CHARS_RE, (s) => {
return s in SPECIAL_CHARACTER_MAP ? SPECIAL_CHARACTER_MAP[s] : "_";
});
}
}
}
Expand Down

0 comments on commit 7b05a55

Please sign in to comment.