Skip to content

Commit

Permalink
fix: an issue that makes node12 incompatible
Browse files Browse the repository at this point in the history
  • Loading branch information
mesqueeb committed May 24, 2023
1 parent 15bfa04 commit 6fa8f8e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function splitAndPrefix(
* @returns the word with the first character in uppercase and the rest in lowercase
*/
export function capitaliseWord(string: string): string {
const i = string.matchAll(magicSplit).next().value
const firstLetterIndex = typeof i === 'number' ? i : 0
const match = string.matchAll(magicSplit).next().value
const firstLetterIndex = match ? match.index : 0
return string.slice(0, firstLetterIndex + 1).toUpperCase() + string.slice(firstLetterIndex + 1).toLowerCase()
}

0 comments on commit 6fa8f8e

Please sign in to comment.