Skip to content
On this page

Word

Module to return various types of words.

adjective

Returns an adjective of random or optionally specified length.

Available since v6.0.0

Parameters

NameTypeDefaultDescription
optionsnumber | { ... }{}

The expected length of the word or the options to use.

options.length?number | { max: number, min: number }

The expected length of the word.

options.strategy?'any-length' | 'closest' | 'fail' | 'longest' | 'shortest''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

ts
faker.word.adjective(options: number | {
  length: number | {
  max: number,
  min: number
},
  strategy: 'any-length' | 'closest' | 'fail' | 'longest' | 'shortest'
} = {}): string
faker.word.adjective() // => "muddy"
faker.word.adjective() // 'pungent'
faker.word.adjective(5) // 'slimy'
faker.word.adjective(100) // 'complete'
faker.word.adjective({ strategy: 'shortest' }) // 'icy'
faker.word.adjective({ length: { min: 5, max: 7 }, strategy: "fail" }) // 'distant'

adverb

Returns an adverb of random or optionally specified length.

Available since v6.0.0

Parameters

NameTypeDefaultDescription
optionsnumber | { ... }{}

The expected length of the word or the options to use.

options.length?number | { max: number, min: number }

The expected length of the word.

options.strategy?'any-length' | 'closest' | 'fail' | 'longest' | 'shortest''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

ts
faker.word.adverb(options: number | {
  length: number | {
  max: number,
  min: number
},
  strategy: 'any-length' | 'closest' | 'fail' | 'longest' | 'shortest'
} = {}): string
faker.word.adverb() // => "often"
faker.word.adverb() // 'quarrelsomely'
faker.word.adverb(5) // 'madly'
faker.word.adverb(100) // 'sadly'
faker.word.adverb({ strategy: 'shortest' }) // 'too'
faker.word.adverb({ length: { min: 5, max: 7 }, strategy: "fail" }) // 'sweetly'

conjunction

Returns a conjunction of random or optionally specified length.

Available since v6.0.0

Parameters

NameTypeDefaultDescription
optionsnumber | { ... }{}

The expected length of the word or the options to use.

options.length?number | { max: number, min: number }

The expected length of the word.

options.strategy?'any-length' | 'closest' | 'fail' | 'longest' | 'shortest''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

ts
faker.word.conjunction(options: number | {
  length: number | {
  max: number,
  min: number
},
  strategy: 'any-length' | 'closest' | 'fail' | 'longest' | 'shortest'
} = {}): string
faker.word.conjunction() // => "provided"
faker.word.conjunction() // 'in order that'
faker.word.conjunction(5) // 'since'
faker.word.conjunction(100) // 'as long as'
faker.word.conjunction({ strategy: 'shortest' }) // 'or'
faker.word.conjunction({ length: { min: 5, max: 7 }, strategy: "fail" }) // 'hence'

interjection

Returns an interjection of random or optionally specified length.

Available since v6.0.0

Parameters

NameTypeDefaultDescription
optionsnumber | { ... }{}

The expected length of the word or the options to use.

options.length?number | { max: number, min: number }

The expected length of the word.

options.strategy?'any-length' | 'closest' | 'fail' | 'longest' | 'shortest''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

ts
faker.word.interjection(options: number | {
  length: number | {
  max: number,
  min: number
},
  strategy: 'any-length' | 'closest' | 'fail' | 'longest' | 'shortest'
} = {}): string
faker.word.interjection() // => "ugh"
faker.word.interjection() // 'gah'
faker.word.interjection(5) // 'fooey'
faker.word.interjection(100) // 'yowza'
faker.word.interjection({ strategy: 'shortest' }) // 'hm'
faker.word.interjection({ length: { min: 5, max: 7 }, strategy: "fail" }) // 'boohoo'

noun

Returns a noun of random or optionally specified length.

Available since v6.0.0

Parameters

NameTypeDefaultDescription
optionsnumber | { ... }{}

The expected length of the word or the options to use.

options.length?number | { max: number, min: number }

The expected length of the word.

options.strategy?'any-length' | 'closest' | 'fail' | 'longest' | 'shortest''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

ts
faker.word.noun(options: number | {
  length: number | {
  max: number,
  min: number
},
  strategy: 'any-length' | 'closest' | 'fail' | 'longest' | 'shortest'
} = {}): string
faker.word.noun() // => "mayor"
faker.word.noun() // 'external'
faker.word.noun(5) // 'front'
faker.word.noun(100) // 'care'
faker.word.noun({ strategy: 'shortest' }) // 'ad'
faker.word.noun({ length: { min: 5, max: 7 }, strategy: "fail" }) // 'average'

preposition

Returns a preposition of random or optionally specified length.

Available since v6.0.0

Parameters

NameTypeDefaultDescription
optionsnumber | { ... }{}

The expected length of the word or the options to use.

options.length?number | { max: number, min: number }

The expected length of the word.

options.strategy?'any-length' | 'closest' | 'fail' | 'longest' | 'shortest''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

ts
faker.word.preposition(options: number | {
  length: number | {
  max: number,
  min: number
},
  strategy: 'any-length' | 'closest' | 'fail' | 'longest' | 'shortest'
} = {}): string
faker.word.preposition() // => "like"
faker.word.preposition() // 'without'
faker.word.preposition(5) // 'abaft'
faker.word.preposition(100) // 'an'
faker.word.preposition({ strategy: 'shortest' }) // 'a'
faker.word.preposition({ length: { min: 5, max: 7 }, strategy: "fail" }) // 'given'

verb

Returns a verb of random or optionally specified length.

Available since v6.0.0

Parameters

NameTypeDefaultDescription
optionsnumber | { ... }{}

The expected length of the word or the options to use.

options.length?number | { max: number, min: number }

The expected length of the word.

options.strategy?'any-length' | 'closest' | 'fail' | 'longest' | 'shortest''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

ts
faker.word.verb(options: number | {
  length: number | {
  max: number,
  min: number
},
  strategy: 'any-length' | 'closest' | 'fail' | 'longest' | 'shortest'
} = {}): string
faker.word.verb() // => "mortar"
faker.word.verb() // 'act'
faker.word.verb(5) // 'tinge'
faker.word.verb(100) // 'mess'
faker.word.verb({ strategy: 'shortest' }) // 'do'
faker.word.verb({ length: { min: 5, max: 7 }, strategy: "fail" }) // 'vault'

Released under the MIT License.