A fast, lightweight utility to generate structured sets of short English words based on specific consonant–vowel patterns. Ideal for creating naming options, extensions, or linguistic variations.
Warning
This library is designed strictly for naming and structural text generation. It is not intended for use as primary keys, secure IDs, or unique identifiers.
Import the Generator class and call generate() with your configuration:
import { Generator } from "@timjoe/word";
const gen = new Generator();
const result = gen.generate(2, "CV", 3);
console.log(result);{
"words": ["ba", "be", "bi"],
"count": 3,
"message": "Success"
}
Invalid lengths or patterns do not throw runtime errors. The generator gracefully defaults to a safe length (2) and pattern ("CV"), capping the maximum output to 13 results while providing notice in the message field.
Total possible outputs are determined by the 21 consonants and 5 vowels available in the English alphabet.
- CV (Consonant-Vowel) → 105 total variations
- VC (Vowel-Consonant) → 105 total variations
- CVC → 2,205 total variations
- VCV / CVV / VVC → 525 variations each
- CCV / VCC → 2,205 variations each
- CVCV / VCVC → 11,025 variations each
- CVVC / VCCV / CCVV → 2,205 variations each
- VVCC → 525 total variations
- CCVC / CVCC → 4,620 variations each
MIT © Timothy T. Joe