@paunovic/random-words

1.2.1 • Public • Published

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

Package Sidebar

Install

npm i @paunovic/random-words

Weekly Downloads

1

Version

1.2.1

License

MIT

Unpacked Size

18.5 MB

Total Files

23

Last publish

Collaborators

  • paunovic