Word
Module to return various types of words.
adjective#
Returns a random adjective.Name | Type | Default | Description |
---|
length | number | | The expected length of the word. |
min | number | | The minimum length of the word. |
max | number | | The maximum length of the word. |
strategy | 'fail' | 'closest' | 'shortest' | 'longest' | 'any-length' | 'any-length' | The strategy to apply when no words with a matching length are found. Available error handling strategies:- fail : Throws an error if no words with the given length are found.- shortest : Returns any of the shortest words.- closest : Returns any of the words closest to the given length.- longest : Returns any of the longest words.- any-length : Returns a word with any length. |
adverb#
Name | Type | Default | Description |
---|
length | number | | The expected length of the word. |
min | number | | The minimum length of the word. |
max | number | | The maximum length of the word. |
strategy | 'fail' | 'closest' | 'shortest' | 'longest' | 'any-length' | 'any-length' | The strategy to apply when no words with a matching length are found. Available error handling strategies:- fail : Throws an error if no words with the given length are found.- shortest : Returns any of the shortest words.- closest : Returns any of the words closest to the given length.- longest : Returns any of the longest words.- any-length : Returns a word with any length. |
conjunction#
Returns a random conjunction.Name | Type | Default | Description |
---|
length | number | | The expected length of the word. |
min | number | | The minimum length of the word. |
max | number | | The maximum length of the word. |
strategy | 'fail' | 'closest' | 'shortest' | 'longest' | 'any-length' | 'any-length' | The strategy to apply when no words with a matching length are found. Available error handling strategies:- fail : Throws an error if no words with the given length are found.- shortest : Returns any of the shortest words.- closest : Returns any of the words closest to the given length.- longest : Returns any of the longest words.- any-length : Returns a word with any length. |
interjection#
Returns a random interjection.Name | Type | Default | Description |
---|
length | number | | The expected length of the word. |
min | number | | The minimum length of the word. |
max | number | | The maximum length of the word. |
strategy | 'fail' | 'closest' | 'shortest' | 'longest' | 'any-length' | 'any-length' | The strategy to apply when no words with a matching length are found. Available error handling strategies:- fail : Throws an error if no words with the given length are found.- shortest : Returns any of the shortest words.- closest : Returns any of the words closest to the given length.- longest : Returns any of the longest words.- any-length : Returns a word with any length. |
preposition#
Returns a random preposition.Name | Type | Default | Description |
---|
length | number | | The expected length of the word. |
min | number | | The minimum length of the word. |
max | number | | The maximum length of the word. |
strategy | 'fail' | 'closest' | 'shortest' | 'longest' | 'any-length' | 'any-length' | The strategy to apply when no words with a matching length are found. Available error handling strategies:- fail : Throws an error if no words with the given length are found.- shortest : Returns any of the shortest words.- closest : Returns any of the words closest to the given length.- longest : Returns any of the longest words.- any-length : Returns a word with any length. |
sample#
Returns a random word, that can be an adjective, adverb, conjunction, interjection, noun, preposition, or verb.Name | Type | Default | Description |
---|
length | number | | The expected length of the word. |
min | number | | The minimum length of the word. |
max | number | | The maximum length of the word. |
strategy | 'fail' | 'closest' | 'shortest' | 'longest' | 'any-length' | 'any-length' | The strategy to apply when no words with a matching length are found. Available error handling strategies:- fail : Throws an error if no words with the given length are found.- shortest : Returns any of the shortest words.- closest : Returns any of the words closest to the given length.- longest : Returns any of the longest words.- any-length : Returns a word with any length. |
verb#
Name | Type | Default | Description |
---|
length | number | | The expected length of the word. |
min | number | | The minimum length of the word. |
max | number | | The maximum length of the word. |
strategy | 'fail' | 'closest' | 'shortest' | 'longest' | 'any-length' | 'any-length' | The strategy to apply when no words with a matching length are found. Available error handling strategies:- fail : Throws an error if no words with the given length are found.- shortest : Returns any of the shortest words.- closest : Returns any of the words closest to the given length.- longest : Returns any of the longest words.- any-length : Returns a word with any length. |
words#
Returns a random string containing some words separated by spaces.Name | Type | Default | Description |
---|
count | number | { min: 1, max: 3 } | The number of words to return. |
min | number | | The minimum length of the word. |
max | number | | The maximum length of the word. |
Modified atΒ 2024-09-02 07:33:03