Skip to content

Commit 431681e

Browse files
authored
docs: fix missing or invalid jsdocs (#2630)
1 parent 8ccc49d commit 431681e

File tree

3 files changed

+35
-6
lines changed

3 files changed

+35
-6
lines changed

src/faker.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ export class Faker extends SimpleFaker {
140140
* customFaker.person.lastName(); // 'Ocampo Corrales'
141141
*
142142
* customFaker.music.genre(); // throws Error as this data is not available in `es`
143+
*
144+
* @since 8.0.0
143145
*/
144146
constructor(options: {
145147
/**
@@ -173,6 +175,11 @@ export class Faker extends SimpleFaker {
173175
* @param options.locale The name of the main locale to use.
174176
* @param options.localeFallback The name of the fallback locale to use.
175177
*
178+
* @example
179+
* new Faker({ locales: allLocales });
180+
*
181+
* @since 6.0.0
182+
*
176183
* @deprecated Use `new Faker({ locale: [locale, localeFallback] })` instead.
177184
*/
178185
constructor(options: {
@@ -210,6 +217,8 @@ export class Faker extends SimpleFaker {
210217
* customFaker.person.lastName(); // 'Ocampo Corrales'
211218
*
212219
* customFaker.music.genre(); // throws Error as this data is not available in `es`
220+
*
221+
* @since 8.0.0
213222
*/
214223
constructor(
215224
options:
@@ -317,6 +326,8 @@ export class Faker extends SimpleFaker {
317326
* // const { faker, fakerES_MX } = require("@faker-js/faker")
318327
* faker.getMetadata(); // { title: 'English', code: 'en', language: 'en', endonym: 'English', dir: 'ltr', script: 'Latn' }
319328
* fakerES_MX.getMetadata(); // { title: 'Spanish (Mexico)', code: 'es_MX', language: 'es', endonym: 'Español (México)', dir: 'ltr', script: 'Latn', country: 'MX' }
329+
*
330+
* @since 8.1.0
320331
*/
321332
getMetadata(): MetadataDefinition {
322333
return this.rawDefinitions.metadata ?? {};

src/modules/location/index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -623,10 +623,9 @@ export class LocationModule extends ModuleBase {
623623
/**
624624
* Generates a random longitude.
625625
*
626-
* @param options An options object.
627-
* @param options.max The upper bound for the longitude to generate. Defaults to `180`.
628-
* @param options.min The lower bound for the longitude to generate. Defaults to `-180`.
629-
* @param options.precision The number of decimal points of precision for the longitude. Defaults to `4`.
626+
* @param max The upper bound for the longitude to generate. Defaults to `180`.
627+
* @param min The lower bound for the longitude to generate. Defaults to `-180`.
628+
* @param precision The number of decimal points of precision for the longitude. Defaults to `4`.
630629
*
631630
* @example
632631
* faker.location.longitude() // -30.9501
@@ -992,8 +991,7 @@ export class LocationModule extends ModuleBase {
992991
/**
993992
* Returns a random ordinal direction (northwest, southeast, etc).
994993
*
995-
* @param options Whether to use abbreviated or an options object.
996-
* @param options.abbreviated If true this will return abbreviated directions (NW, SE, etc).
994+
* @param abbreviated If true this will return abbreviated directions (NW, SE, etc).
997995
* Otherwise this will return the long name. Defaults to `false`.
998996
*
999997
* @example

src/simple-faker.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ export class SimpleFaker {
6565
*
6666
* faker.defaultRefDate() // 2020-01-01T00:00:01Z
6767
* faker.defaultRefDate() // 2020-01-01T00:00:02Z
68+
*
69+
* @since 8.0.0
6870
*/
6971
setDefaultRefDate(
7072
dateOrSource: string | Date | number | (() => Date) = () => new Date()
@@ -95,6 +97,18 @@ export class SimpleFaker {
9597
* Specify this only if you want to use it to achieve a specific goal,
9698
* such as sharing the same random generator with other instances/tools.
9799
* Defaults to faker's Mersenne Twister based pseudo random number generator.
100+
*
101+
* @example
102+
* import { SimpleFaker } from '@faker-js/faker';
103+
* // const { SimpleFaker } = require('@faker-js/faker');
104+
*
105+
* // create a SimpleFaker without any locale data
106+
* const customSimpleFaker = new SimpleFaker();
107+
*
108+
* customSimpleFaker.helpers.arrayElement([red', 'green', 'blue']); // 'green'
109+
* customSimpleFaker.number.int(10); // 4
110+
*
111+
* @since 8.1.0
98112
*/
99113
constructor(
100114
options: {
@@ -146,6 +160,8 @@ export class SimpleFaker {
146160
* // Random but reproducible tests:
147161
* // Simply log the seed, and if you need to reproduce it, insert the seed here
148162
* console.log('Running test with seed:', faker.seed());
163+
*
164+
* @since 6.0.0
149165
*/
150166
seed(seed?: number): number;
151167
/**
@@ -181,6 +197,8 @@ export class SimpleFaker {
181197
* // Random but reproducible tests:
182198
* // Simply log the seed, and if you need to reproduce it, insert the seed here
183199
* console.log('Running test with seed:', faker.seed());
200+
*
201+
* @since 6.0.0
184202
*/
185203
seed(seedArray: number[]): number[];
186204
/**
@@ -225,6 +243,8 @@ export class SimpleFaker {
225243
* // Random but reproducible tests:
226244
* // Simply log the seed, and if you need to reproduce it, insert the seed here
227245
* console.log('Running test with seed:', faker.seed());
246+
*
247+
* @since 6.0.0
228248
*/
229249
seed(seed?: number | number[]): number | number[];
230250
seed(

0 commit comments

Comments
 (0)