Skip to content

Commit

Permalink
allow any capitalization (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
cubedhuang authored Jan 13, 2023
1 parent c41cec5 commit d2dfd5e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function getWord(text: string, index: number): string | null {
// Alpha word
const preIndex = text.slice(0, index).match(/[a-z]*$/i)![0]
const postIndex = text.slice(index).match(/^[a-z]*/i)![0]
return preIndex + postIndex || null
return (preIndex + postIndex)?.toLowerCase() || null
}

/** https://stackoverflow.com/a/3710561/6719456 */
Expand Down

0 comments on commit d2dfd5e

Please sign in to comment.