Skip to content

Commit

Permalink
Fix one letter capital letters being lower cased in sentence case
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayyy committed Oct 8, 2024
1 parent 6a3917d commit 13d8802
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/titles/titleFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export async function toSentenceCase(str: string, isCustom: boolean): Promise<st
} else if (forceKeepFormatting(word)
|| isAcronymStrict(word)
|| ((!inTitleCase || !isWordCapitalCase(word)) && trustCaps && isAcronym(word))
|| (!inTitleCase && trustCaps && word.length === 1)
|| (!inTitleCase && isWordCapitalCase(word))
|| (isCustom && isWordCustomCapitalization(word))
|| (!isAllCaps(word) && isWordCustomCapitalization(word))
Expand Down
1 change: 1 addition & 0 deletions test/titleFormatter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ describe("toSentenceCase", () => {
["One thing: then another thing", "One thing: Then another thing"],
["One thing: but-then another thing", "One thing: But-then another thing"],
["Why I Won't Buy Into The Tesla Cybertruck Hype When my Alternative is Much More Fun", "Why I won't buy into the tesla cybertruck hype when my alternative is much more fun"],
["Thorzone Nano Q case review", "Thorzone Nano Q case review"],
];
for (const testCase of sentenceCases) {
const [input, expected] = testCase;
Expand Down

0 comments on commit 13d8802

Please sign in to comment.