Skip to content

Commit

Permalink
Fix capitalizing words that start with numbers (#346)
Browse files Browse the repository at this point in the history
  • Loading branch information
v-fernandez authored Sep 13, 2024
1 parent 759c9a5 commit 976fa36
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/title-case/src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ const TEST_CASES: [string, string, Options?][] = [
'An example. "I.e. test."',
{ sentenceCase: true },
],
["friday the 13th", "Friday the 13th"],
["21st century", "21st Century"],
];

describe("swap case", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/title-case/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const TOKENS = /(\S+)|(.)/g;
const IS_SPECIAL_CASE = /[\.#]\p{Alphabetic}/u; // #tag, example.com, etc.
const IS_MANUAL_CASE = /\p{Ll}(?=[\p{Lu}])/u; // iPhone, iOS, etc.
const ALPHANUMERIC_PATTERN = /\p{Alphabetic}+/gu;
const ALPHANUMERIC_PATTERN = /[\p{Alphabetic}\p{Nd}]+/gu;
const IS_ACRONYM =
/^(\P{Alphabetic})*(?:\p{Alphabetic}\.){2,}(\P{Alphabetic})*$/u;

Expand Down

0 comments on commit 976fa36

Please sign in to comment.