Skip to content

Latest commit

 

History

History
58 lines (37 loc) · 1.83 KB

README.md

File metadata and controls

58 lines (37 loc) · 1.83 KB

Random words

Package for generating random word(s) in multiple languages.

Testing

Try it Online

Link to Codepen playground

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.

License

MIT © Milos Paunovic