Package for generating random word(s) in multiple languages.
npm i @paunovic/random-words
import { initialize } from '@paunovic/random-words'
// Initialization with default language pack
const RANDOM = initialize();
// Initialization with different language pack
const RANDOM = initialize({ countryCode: 'rs' })
// Initialization with different language pack, including variation
const RANDOM = initialize({ countryCode: 'rs', variation: 'cyrillic' })
Currently available country codes and variations:
Country | Country code | Variation |
---|---|---|
Serbia | rs |
cyrillic |
United States * |
us |
|
Spain | es |
*
Default language; if no countryCode
parameter is passed to initialize
method, english will be loaded as a default language.
// Returns random word from the dictionary
RANDOM.word()
// Returns array of words from the dictionary, defaults to 10, could be overridden
RANDOM.words(howMany = 10)
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please try to follow semantic commit messages principle to simplify navigation through git history.