UNPKG

pig-latinizer

Version:

Translates English text to Pig Latin, with proper handling of capitalization, punctuation, and hyphenated phrases

36 lines (30 loc) 1.04 kB
/** * Translates English to Pig Latin. */ declare class PigLatin { /** Words which should be excluded from translation. Case-sensitive. */ readonly exclusions: string[]; /** * Translates an English string, containing an arbitrary amount of text, to Pig Latin. * Punctuation and whitespace are preserved, including blank lines. * * @param english The English string to translate. */ translate(english: string): string; /** * Translates a single fragment (word or separator) to Pig Latin. * @param fragment The word to translate or ignore, or separator to ignore. */ private _translateOne; /** * Splits a string into an array of fragments, i.e. alternating words and separators. * @param str The string to split. */ private _split; /** * Gets the index of the first vowel in the given word, or -1 if it contains no vowels. * @param word The word in which to find a vowel. */ private _indexOfFirstVowel; } export default PigLatin;