Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
noootwo committed Nov 22, 2024
1 parent 6ff2a26 commit ac32adf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ lowerFirst("Hello world!");

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

- Splits string by the splitters provided (default: `['-', '_', '/', '.']`)
- Splits string by the splitters provided (default: `['-', '_', '/', '.', ' ']`)
- Splits when case changes from lower to upper or upper to lower
- Ignores numbers for case changes
- Case is preserved in returned value
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ export function titleCase<
>(str?: T, opts?: UserCaseOptions) {
return (Array.isArray(str) ? str : splitByCase(str as string))
.filter(Boolean)
.map((p, i) =>
i && titleCaseExceptions.test(p)
.map((p, index) =>
index > 0 && titleCaseExceptions.test(p)
? p.toLowerCase()
: upperFirst(opts?.normalize ? p.toLowerCase() : p),
)
Expand Down

0 comments on commit ac32adf

Please sign in to comment.