Skip to main content

Word

Module to return various types of words.


adjective

Returns a random adjective.

Parameters

NameTypeDefaultDescription
lengthnumberThe expected length of the word.
minnumberThe minimum length of the word.
maxnumberThe 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.

Returns: string

Examples

{{$word.adjective}}  // 'cumbersome'

{{$word.adjective(length=5)}} // 'rough'

{{$word.adjective(strategy='shortest')}} // 'hot'

{{$word.adjective(min=3,max=6,strategy='shortest')}} // 'late'

adverb

Returns a random adverb.

Parameters

NameTypeDefaultDescription
lengthnumberThe expected length of the word.
minnumberThe minimum length of the word.
maxnumberThe 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.

Returns: string

Examples

{{$word.adverb}} // 'famously'

{{$word.adverb(length=5)}} // 'never'

{{$word.adverb(strategy='shortest')}} // 'too'

{{$word.adverb(min=2,max=5,strategy='fail')}} // 'fast'

conjunction

Returns a random conjunction.

Parameters

NameTypeDefaultDescription
lengthnumberThe expected length of the word.
minnumberThe minimum length of the word.
maxnumberThe 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.

Returns: string

Examples

{{$word.conjunction}} // 'whenever'

{{$word.conjunction(length=5)}} // 'hence'

{{$word.conjunction(strategy='shortest')}} // 'as'

{{$word.conjunction(min=2,max=5,strategy='fail')}} // 'while'

interjection

Returns a random interjection.

Parameters

NameTypeDefaultDescription
lengthnumberThe expected length of the word.
minnumberThe minimum length of the word.
maxnumberThe 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.

Returns: string

Examples

{{$word.interjection}} // 'oh'

{{$word.interjection(length=5)}} // 'yahoo'

{{$word.interjection(strategy='shortest')}} // 'hm'

{{$word.interjection(min=2,max=5,strategy='fail')}} // 'aw'

preposition

Returns a random preposition.

Parameters

NameTypeDefaultDescription
lengthnumberThe expected length of the word.
minnumberThe minimum length of the word.
maxnumberThe 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.

Returns: string

Examples

{{$word.preposition}} // 'midst'

{{$word.preposition(length=5)}} // 'among'

{{$word.preposition(strategy='shortest')}} // 'a'

{{$word.preposition(min=2,max=5,strategy='fail')}} // 'until'

sample

Returns a random word, that can be an adjective, adverb, conjunction, interjection, noun, preposition, or verb.

Parameters

NameTypeDefaultDescription
lengthnumberThe expected length of the word.
minnumberThe minimum length of the word.
maxnumberThe 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.

Returns: string

Examples

{{$word.sample}} // 'toothpick'

{{$word.sample(length=5)}} // 'lucky'

{{$word.sample(strategy='shortest')}} // 'aw'

{{$word.sample(min=2,max=5,strategy='fail')}} // 'dimly'

verb

Returns a random verb.

Parameters

NameTypeDefaultDescription
lengthnumberThe expected length of the word.
minnumberThe minimum length of the word.
maxnumberThe 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.

Returns: string

Examples

{{$word.verb}} // 'fashion'

{{$word.verb(length=5)}} // 'rival'

{{$word.verb(strategy='shortest')}} // 'ape'

{{$word.verb(min=2,max=5,strategy='fail')}} // 'draft'

words

Returns a random string containing some words separated by spaces.

Parameters

NameTypeDefaultDescription
countnumber{ min: 1, max: 3 }The number of words to return.
minnumberThe minimum length of the word.
maxnumberThe maximum length of the word.

Returns: string

Examples

{{$word.verb}} // 'gah'

{{$word.words(count=5)}} // 'readies wholly eek integer monocle'

{{$word.words(count=5,min=5,max=12)}} // 'now accidentally repeat incinerate crafty jell badly forenenst before verve'