Skip to content

Commit ac32adf

Browse files
committed
chore: update
1 parent 6ff2a26 commit ac32adf

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ lowerFirst("Hello world!");
119119

120120
### `splitByCase(str, splitters?)`
121121

122-
- Splits string by the splitters provided (default: `['-', '_', '/', '.']`)
122+
- Splits string by the splitters provided (default: `['-', '_', '/', '.', ' ']`)
123123
- Splits when case changes from lower to upper or upper to lower
124124
- Ignores numbers for case changes
125125
- Case is preserved in returned value

src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ export function titleCase<
186186
>(str?: T, opts?: UserCaseOptions) {
187187
return (Array.isArray(str) ? str : splitByCase(str as string))
188188
.filter(Boolean)
189-
.map((p, i) =>
190-
i && titleCaseExceptions.test(p)
189+
.map((p, index) =>
190+
index > 0 && titleCaseExceptions.test(p)
191191
? p.toLowerCase()
192192
: upperFirst(opts?.normalize ? p.toLowerCase() : p),
193193
)

0 commit comments

Comments
 (0)