Skip to content

Commit 976fa36

Browse files
authored
Fix capitalizing words that start with numbers (#346)
1 parent 759c9a5 commit 976fa36

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

packages/title-case/src/index.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ const TEST_CASES: [string, string, Options?][] = [
144144
'An example. "I.e. test."',
145145
{ sentenceCase: true },
146146
],
147+
["friday the 13th", "Friday the 13th"],
148+
["21st century", "21st Century"],
147149
];
148150

149151
describe("swap case", () => {

packages/title-case/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const TOKENS = /(\S+)|(.)/g;
22
const IS_SPECIAL_CASE = /[\.#]\p{Alphabetic}/u; // #tag, example.com, etc.
33
const IS_MANUAL_CASE = /\p{Ll}(?=[\p{Lu}])/u; // iPhone, iOS, etc.
4-
const ALPHANUMERIC_PATTERN = /\p{Alphabetic}+/gu;
4+
const ALPHANUMERIC_PATTERN = /[\p{Alphabetic}\p{Nd}]+/gu;
55
const IS_ACRONYM =
66
/^(\P{Alphabetic})*(?:\p{Alphabetic}\.){2,}(\P{Alphabetic})*$/u;
77

0 commit comments

Comments
 (0)