@paunovic/random-words
v1.2.1
Published
Serving random words in any language has never been this easy.
Downloads
57
Maintainers
Readme
Random words
Package for generating random word(s) in multiple languages.
Try it Online
Installation
npm i @paunovic/random-words
Configuring
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.
Methods
// 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)
Contributing
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.