Generate Mattophobia-like sentences
The package is on the NPM registry as mattophobia
. Simply install it with your NPM client of choice.
First, import the module:
const mattophobia = require('mattophobia')
mattophobia()
is an ES6 generator function that creates an IterableIterator<string>
.
It returns an infinite series of Mattophobia strings.
You can pass in an object with options when instantiating the generator.
Option | Type | Default | Description |
---|---|---|---|
ings |
string[] |
see constants.ts |
Words ending with -ing for the generator |
swears |
string[] |
see constants.ts |
Profanity for the generator |
standalone |
string[] |
see constants.ts |
Standalone phrases for the generator |
minWords |
number |
4 |
Minimum number of words per sentence |
maxWords |
number |
18 |
Maximum number of words per sentence |
maxLength |
number |
140 |
Maximum length of the string. Set to < 1 for no limit. |
// Import the module
const mattophobia = require('mattophobia')
// Limit to tweet length
const generator = mattophobia({ maxLength: 280 })
console.log(generator.next().value)