From 10db390165b2f8cdafbe17f249b77c5f9bfa7d9b Mon Sep 17 00:00:00 2001 From: "yuting2.liu" Date: Tue, 10 Dec 2024 17:12:57 +0800 Subject: [PATCH] fix: title --- src/string.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/string.ts b/src/string.ts index 45c13e25..fe788032 100644 --- a/src/string.ts +++ b/src/string.ts @@ -105,6 +105,8 @@ export const title = (str: string | null | undefined): string => { return str .split(/(?=[A-Z][a-z])|[\.\-\s_]/) + .map(s => s.trim()) + .filter(s => !!s) .map(s => { if (s === s.toUpperCase()) { // If the entire string segment is uppercase, capitalize it properly