Skip to main content

adjustCasing

Adjusts the casing of the target text based on the matched text.
export const adjustCasing = (matchedText: string, targetText: string): string
matchedText
string
required
The text that was matched in the original text.
targetText
string
required
The target replacement text.
return
string
The target text with adjusted casing.

findFirstAlphaIndex

Finds the index of the first alphabetic letter in a string.
export const findFirstAlphaIndex = (str: string): number
str
string
required
The string to search.
return
number
The index of the first alphabetic letter, or -1 if none found.

generateCaseVariants

Generates case variants for a given source string by toggling the case of the first alphabetic character.
export const generateCaseVariants = (source: string): string[]
source
string
required
The source string.
return
string[]
An array containing the original string and its case variants.

isAlphabeticLetter

Determines if a character is an alphabetic letter (excluding apostrophe-like characters).
export const isAlphabeticLetter = (char: string): boolean
char
string
required
The character to check.
return
boolean
True if the character is an alphabetic letter, false otherwise.

isLetter

Checks if the given character is a letter.
export const isLetter = (char: string): boolean
char
string
required
The character to check.
return
boolean
True if the character is a letter, false otherwise.

isLowerCase

Checks if the given character is lowercase.
export const isLowerCase = (char: string): boolean
char
string
required
The character to check.
return
boolean
True if the character is lowercase, false otherwise.

isUpperCase

Checks if the given character is uppercase.
export const isUpperCase = (char: string): boolean
char
string
required
The character to check.
return
boolean
True if the character is uppercase, false otherwise.

isWordCharacterAt

Determines if a character at a given position is considered a word character. An apostrophe is considered a word character only if it’s between letters.
export const isWordCharacterAt = (text: string, index: number): boolean
text
string
required
The text containing the character.
index
number
required
The position of the character in the text.
return
boolean
True if the character is a word character, false otherwise.

Build docs developers (and LLMs) love