aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPiotr Kuczynski <[email protected]>2022-03-29 09:17:29 +0200
committerGitHub <[email protected]>2022-03-29 07:17:29 +0000
commit6fd60823e27f7d797626341dcfe9ab336c13b92f (patch)
treee9b8ad6511330f53cfcdfd2eec79749a40509014 /src
parent928f5d3b9395bb8343df6b349ecb530fbf7566ea (diff)
downloadfaker-6fd60823e27f7d797626341dcfe9ab336c13b92f.tar.xz
faker-6fd60823e27f7d797626341dcfe9ab336c13b92f.zip
docs: add jsdoc examples to faker.word (#717)
Diffstat (limited to 'src')
-rw-r--r--src/word.ts56
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;