diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/word.ts | 56 |
1 files changed, 42 insertions, 14 deletions
diff --git a/src/word.ts b/src/word.ts index 4570e964..2b1e5e4f 100644 --- a/src/word.ts +++ b/src/word.ts @@ -16,9 +16,13 @@ export class Word { /** * Returns an adjective of random or optionally specified length. - * If specified length is unresolvable, returns random adjective. * - * @param length The optional length of word to return. + * @param length Expected adjective length. If specified length is unresolvable, returns adjective of a random length. + * + * @example + * faker.word.adjective() // 'pungent' + * faker.word.adjective(5) // 'slimy' + * faker.word.adjective(100) // 'complete' */ adjective(length?: number): string { let wordList = this.faker.definitions.word.adjective; @@ -38,9 +42,13 @@ export class Word { /** * Returns an adverb of random or optionally specified length. - * If specified length is unresolvable, returns random adverb. * - * @param length The optional length of word to return. + * @param length Expected adverb length. If specified length is unresolvable, returns adverb of a random length. + * + * @example + * faker.word.adverb() // 'quarrelsomely' + * faker.word.adverb(5) // 'madly' + * faker.word.adverb(100) // 'sadly' */ adverb(length?: number): string { let wordList = this.faker.definitions.word.adverb; @@ -60,9 +68,13 @@ export class Word { /** * Returns a conjunction of random or optionally specified length. - * If specified length is unresolvable, returns random conjunction. * - * @param length The optional length of word to return. + * @param length Expected conjunction length. If specified length is unresolvable, returns conjunction of a random length. + * + * @example + * faker.word.conjunction() // 'in order that' + * faker.word.conjunction(5) // 'since' + * faker.word.conjunction(100) // 'as long as' */ conjunction(length?: number): string { let wordList = this.faker.definitions.word.conjunction; @@ -82,9 +94,13 @@ export class Word { /** * Returns an interjection of random or optionally specified length. - * If specified length is unresolvable, returns random interjection. * - * @param length The optional length of word to return. + * @param length Expected interjection length. If specified length is unresolvable, returns interjection of a random length. + * + * @example + * faker.word.interjection() // 'gah' + * faker.word.interjection(5) // 'fooey' + * faker.word.interjection(100) // 'yowza' */ interjection(length?: number): string { let wordList = this.faker.definitions.word.interjection; @@ -104,9 +120,13 @@ export class Word { /** * Returns a noun of random or optionally specified length. - * If specified length is unresolvable, returns random noun. * - * @param length The optional length of word to return. + * @param length Expected noun length. If specified length is unresolvable, returns noun of a random length. + * + * @example + * faker.word.noun() // 'external' + * faker.word.noun(5) // 'front' + * faker.word.noun(100) // 'care' */ noun(length?: number): string { let wordList = this.faker.definitions.word.noun; @@ -126,9 +146,13 @@ export class Word { /** * Returns a preposition of random or optionally specified length. - * If specified length is unresolvable, returns random preposition. * - * @param length The optional length of word to return. + * @param length Expected preposition length. If specified length is unresolvable, returns preposition of a random length. + * + * @example + * faker.word.preposition() // 'without' + * faker.word.preposition(5) // 'abaft' + * faker.word.preposition(100) // 'an' */ preposition(length?: number): string { let wordList = this.faker.definitions.word.preposition; @@ -148,9 +172,13 @@ export class Word { /** * Returns a verb of random or optionally specified length. - * If specified length is unresolvable, returns random verb. * - * @param length The optional length of word to return. + * @param length Expected verb length. If specified length is unresolvable, returns verb of a random length. + * + * @example + * faker.word.verb() // 'act' + * faker.word.verb(5) // 'tinge' + * faker.word.verb(100) // 'mess' */ verb(length?: number): string { let wordList = this.faker.definitions.word.verb; |
