Generates a string with a minimum and a maximum number of random words picking from a dictionary.
- Source:
Methods
(static) generateText(object) → {string}
- Source:
Example
import { generateText } from '@untemps/utils/string/generateText'
const minWords = 5;
const maxWords = 10;
const dictionary = ['foo', 'bar', 'gag'];
generateText({minWords, maxWords, dictionary}) // bar foo foo gag gag bar gag gag
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
object |
object | The configuration object for the text generation. Properties
|
Returns:
The generated string.
- Type
- string