Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/quicktype-core/src/language/CPlusPlus/language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { CPlusPlusRenderer } from "./CPlusPlusRenderer";
// FIXME: share with CJSON
const namingStyles = {
"pascal-case": "pascal",
"original-case": "original",
"underscore-case": "underscore",
"camel-case": "camel",
"upper-underscore-case": "upper-underscore",
Expand Down
12 changes: 10 additions & 2 deletions packages/quicktype-core/src/support/Strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export type NamingStyle =
| "underscore"
| "upper-underscore"
| "pascal-upper-acronyms"
| "camel-upper-acronyms";
| "camel-upper-acronyms"
| "original";

function computeAsciiMap(mapper: (codePoint: number) => string): {
charNoEscapeMap: number[];
Expand Down Expand Up @@ -598,7 +599,8 @@ export function makeNameStyle(
namingStyle === "pascal" ||
namingStyle === "camel" ||
namingStyle === "pascal-upper-acronyms" ||
namingStyle === "camel-upper-acronyms"
namingStyle === "camel-upper-acronyms" ||
namingStyle === "original"
) {
separator = "";
if (
Expand Down Expand Up @@ -637,11 +639,17 @@ export function makeNameStyle(
restAcronymStyle =
allUpperWordStyle;
break;
case "original":
firstWordStyle = restWordStyle = firstWordAcronymStyle = restAcronymStyle = originalWord;
break;
default:
return assertNever(namingStyle);
}

return (original: string) => {
if (namingStyle === "original")
return original;

const words = splitIntoWords(original);

const styledName = combineWords(
Expand Down
Loading