File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed
Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -97,10 +97,10 @@ export {
9797export { isSemver , normalizeSemver , sortSemvers } from './lib/semver.js' ;
9898export {
9999 camelCaseToKebabCase ,
100- kebabCaseToSentence ,
101100 kebabCaseToCamelCase ,
102- formatToSentenceCase ,
103101 capitalize ,
102+ toSentenceCase ,
103+ toTitleCase ,
104104} from './lib/case-conversions.js' ;
105105export * from './lib/text-formats/index.js' ;
106106export {
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ export function toTitleCase(input: string): string {
7575
7676 // Capitalize first word or non-minor words
7777 if ( index === 0 || ! minorWords . has ( word . toLowerCase ( ) ) ) {
78- return word . charAt ( 0 ) . toUpperCase ( ) + word . slice ( 1 ) . toLowerCase ( ) ;
78+ return capitalize ( word ) ;
7979 }
8080 return word . toLowerCase ( ) ;
8181 } )
@@ -103,7 +103,5 @@ export function toSentenceCase(input: string): string {
103103}
104104
105105export function capitalize < T extends string > ( text : T ) : Capitalize < T > {
106- return `${ text . charAt ( 0 ) . toLocaleUpperCase ( ) } ${ text . slice (
107- 1 ,
108- ) } ` as Capitalize < T > ;
106+ return `${ text . charAt ( 0 ) . toLocaleUpperCase ( ) } ${ text . slice ( 1 ) . toLowerCase ( ) } ` as Capitalize < T > ;
109107}
You can’t perform that action at this time.
0 commit comments