RecordKey>(
diff --git a/src/modules/vehicle/index.ts b/src/modules/vehicle/index.ts
index 903dab539e8..cd01ece30c9 100644
--- a/src/modules/vehicle/index.ts
+++ b/src/modules/vehicle/index.ts
@@ -3,10 +3,10 @@ import type { Faker } from '../..';
/**
* Module to generate vehicle related entries.
*/
-export class Vehicle {
+export class VehicleModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Vehicle.prototype)) {
+ for (const name of Object.getOwnPropertyNames(VehicleModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
@@ -19,6 +19,8 @@ export class Vehicle {
*
* @example
* faker.vehicle.vehicle() // 'BMW Explorer'
+ *
+ * @since 5.0.0
*/
vehicle(): string {
return `${this.manufacturer()} ${this.model()}`;
@@ -29,6 +31,8 @@ export class Vehicle {
*
* @example
* faker.vehicle.manufacturer() // 'Ford'
+ *
+ * @since 5.0.0
*/
manufacturer(): string {
return this.faker.helpers.arrayElement(
@@ -41,6 +45,8 @@ export class Vehicle {
*
* @example
* faker.vehicle.model() // 'Explorer'
+ *
+ * @since 5.0.0
*/
model(): string {
return this.faker.helpers.arrayElement(
@@ -53,6 +59,8 @@ export class Vehicle {
*
* @example
* faker.vehicle.type() // 'Coupe'
+ *
+ * @since 5.0.0
*/
type(): string {
return this.faker.helpers.arrayElement(this.faker.definitions.vehicle.type);
@@ -63,6 +71,8 @@ export class Vehicle {
*
* @example
* faker.vehicle.fuel() // 'Electric'
+ *
+ * @since 5.0.0
*/
fuel(): string {
return this.faker.helpers.arrayElement(this.faker.definitions.vehicle.fuel);
@@ -73,6 +83,8 @@ export class Vehicle {
*
* @example
* faker.vehicle.vin() // 'YV1MH682762184654'
+ *
+ * @since 5.0.0
*/
vin(): string {
const bannedChars = ['o', 'i', 'q', 'O', 'I', 'Q'];
@@ -95,6 +107,8 @@ export class Vehicle {
*
* @example
* faker.vehicle.color() // 'red'
+ *
+ * @since 5.0.0
*/
color(): string {
return this.faker.color.human();
@@ -105,6 +119,8 @@ export class Vehicle {
*
* @example
* faker.vehicle.vrm() // 'MF56UPA'
+ *
+ * @since 5.4.0
*/
vrm(): string {
return `${this.faker.random.alpha({
@@ -124,6 +140,8 @@ export class Vehicle {
*
* @example
* faker.vehicle.bicycle() // 'Adventure Road Bicycle'
+ *
+ * @since 5.5.0
*/
bicycle(): string {
return this.faker.helpers.arrayElement(
diff --git a/src/modules/word/index.ts b/src/modules/word/index.ts
index 5968d225b3b..725c0c4263f 100644
--- a/src/modules/word/index.ts
+++ b/src/modules/word/index.ts
@@ -28,10 +28,10 @@ function filterWordListByLength(options: {
/**
* Module to return various types of words.
*/
-export class Word {
+export class WordModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Word.prototype)) {
+ for (const name of Object.getOwnPropertyNames(WordModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
@@ -48,6 +48,8 @@ export class Word {
* faker.word.adjective() // 'pungent'
* faker.word.adjective(5) // 'slimy'
* faker.word.adjective(100) // 'complete'
+ *
+ * @since 6.0.0
*/
adjective(length?: number): string {
return this.faker.helpers.arrayElement(
@@ -67,6 +69,8 @@ export class Word {
* faker.word.adverb() // 'quarrelsomely'
* faker.word.adverb(5) // 'madly'
* faker.word.adverb(100) // 'sadly'
+ *
+ * @since 6.0.0
*/
adverb(length?: number): string {
return this.faker.helpers.arrayElement(
@@ -86,6 +90,8 @@ export class Word {
* faker.word.conjunction() // 'in order that'
* faker.word.conjunction(5) // 'since'
* faker.word.conjunction(100) // 'as long as'
+ *
+ * @since 6.0.0
*/
conjunction(length?: number): string {
return this.faker.helpers.arrayElement(
@@ -105,6 +111,8 @@ export class Word {
* faker.word.interjection() // 'gah'
* faker.word.interjection(5) // 'fooey'
* faker.word.interjection(100) // 'yowza'
+ *
+ * @since 6.0.0
*/
interjection(length?: number): string {
return this.faker.helpers.arrayElement(
@@ -124,6 +132,8 @@ export class Word {
* faker.word.noun() // 'external'
* faker.word.noun(5) // 'front'
* faker.word.noun(100) // 'care'
+ *
+ * @since 6.0.0
*/
noun(length?: number): string {
return this.faker.helpers.arrayElement(
@@ -143,6 +153,8 @@ export class Word {
* faker.word.preposition() // 'without'
* faker.word.preposition(5) // 'abaft'
* faker.word.preposition(100) // 'an'
+ *
+ * @since 6.0.0
*/
preposition(length?: number): string {
return this.faker.helpers.arrayElement(
@@ -162,6 +174,8 @@ export class Word {
* faker.word.verb() // 'act'
* faker.word.verb(5) // 'tinge'
* faker.word.verb(100) // 'mess'
+ *
+ * @since 6.0.0
*/
verb(length?: number): string {
return this.faker.helpers.arrayElement(
diff --git a/test/__snapshots__/datatype.spec.ts.snap b/test/__snapshots__/datatype.spec.ts.snap
index 7980ec5c2d3..0c92b8fee86 100644
--- a/test/__snapshots__/datatype.spec.ts.snap
+++ b/test/__snapshots__/datatype.spec.ts.snap
@@ -76,8 +76,6 @@ exports[`datatype > 42 > hexadecimal > with casing 1`] = `"0x8"`;
exports[`datatype > 42 > hexadecimal > with length 1`] = `"0x8BE4ABdd39321aD7d3fe01FfCE404F4d6db0906bd8"`;
-exports[`datatype > 42 > hexadecimal > with length and casing 1`] = `"0x8be4abdd39321ad7d3fe"`;
-
exports[`datatype > 42 > hexadecimal > with length, prefix, and casing 1`] = `"0x8be4abdd39321ad7d3fe"`;
exports[`datatype > 42 > hexadecimal > with prefix 1`] = `"0x8"`;
@@ -194,8 +192,6 @@ exports[`datatype > 1211 > hexadecimal > with casing 1`] = `"0xe"`;
exports[`datatype > 1211 > hexadecimal > with length 1`] = `"0xEaDB42F0e3f4A973fAB0AeefCE96DFCF49cD438dF9"`;
-exports[`datatype > 1211 > hexadecimal > with length and casing 1`] = `"0xeadb42f0e3f4a973fab0"`;
-
exports[`datatype > 1211 > hexadecimal > with length, prefix, and casing 1`] = `"0xeadb42f0e3f4a973fab0"`;
exports[`datatype > 1211 > hexadecimal > with prefix 1`] = `"0xE"`;
@@ -312,8 +308,6 @@ exports[`datatype > 1337 > hexadecimal > with casing 1`] = `"0x5"`;
exports[`datatype > 1337 > hexadecimal > with length 1`] = `"0x5c346ba075bd57F5A62B82d72AF39CBBB07a98cbA8"`;
-exports[`datatype > 1337 > hexadecimal > with length and casing 1`] = `"0x5c346ba075bd57f5a62b"`;
-
exports[`datatype > 1337 > hexadecimal > with length, prefix, and casing 1`] = `"0x5c346ba075bd57f5a62b"`;
exports[`datatype > 1337 > hexadecimal > with prefix 1`] = `"0x5"`;
diff --git a/test/mersenne.spec.ts b/test/mersenne.spec.ts
index 4ed803af823..62b65a69be6 100644
--- a/test/mersenne.spec.ts
+++ b/test/mersenne.spec.ts
@@ -1,6 +1,6 @@
import { beforeAll, beforeEach, describe, expect, it } from 'vitest';
import { FakerError } from '../src/errors/faker-error';
-import { Mersenne } from '../src/modules/mersenne';
+import { MersenneModule } from '../src/modules/mersenne';
import { seededRuns } from './support/seededRuns';
const minMaxTestCases = [
@@ -14,10 +14,10 @@ const functionNames = ['rand'];
const NON_SEEDED_BASED_RUN = 25;
describe('mersenne twister', () => {
- let mersenne: Mersenne;
+ let mersenne: MersenneModule;
beforeEach(() => {
- mersenne = new Mersenne();
+ mersenne = new MersenneModule();
});
for (const seed of [...seededRuns, [42, 1, 2], [1337, 1, 2], [1211, 1, 2]]) {
diff --git a/test/scripts/apidoc/examplesAndDeprecations.spec.ts b/test/scripts/apidoc/examplesAndDeprecations.spec.ts
index 83443c524d6..4c94dedd442 100644
--- a/test/scripts/apidoc/examplesAndDeprecations.spec.ts
+++ b/test/scripts/apidoc/examplesAndDeprecations.spec.ts
@@ -9,6 +9,7 @@ import { selectApiModules } from '../../../scripts/apidoc/moduleMethods';
import {
extractRawExamples,
extractSeeAlsos,
+ extractSince,
extractTagContent,
isDeprecated,
} from '../../../scripts/apidoc/utils';
@@ -119,6 +120,8 @@ describe('examples and deprecations', () => {
expect(link, 'Expect method reference to contain ()').toContain(')');
}
});
+
+ expect(extractSince(signature), '@since to be present').toBeTruthy();
});
});
});
diff --git a/test/scripts/apidoc/signature.example.ts b/test/scripts/apidoc/signature.example.ts
index b11d40a5e8b..43407ab980b 100644
--- a/test/scripts/apidoc/signature.example.ts
+++ b/test/scripts/apidoc/signature.example.ts
@@ -240,4 +240,13 @@ export class SignatureTest {
methodWithMultipleSeeMarkers(): number {
return 0;
}
+
+ /**
+ * Test with since marker.
+ *
+ * @since 1.0.0
+ */
+ methodWithSinceMarker(): number {
+ return 0;
+ }
}
diff --git a/test/scripts/apidoc/signature.expected.json b/test/scripts/apidoc/signature.expected.json
index 4aaa97b5fce..15145f533e6 100644
--- a/test/scripts/apidoc/signature.expected.json
+++ b/test/scripts/apidoc/signature.expected.json
@@ -11,6 +11,7 @@
"description": "The boolean parameter.
\n"
}
],
+ "since": "",
"returns": "number",
"examples": "tsfaker.defaultBooleanParamMethod(c: boolean = true): number\n
\n
",
"deprecated": false,
@@ -27,6 +28,7 @@
"description": "The function parameter.
\n"
}
],
+ "since": "",
"returns": "number",
"examples": "tsfaker.functionParamMethod(fn: (a: string) => number): number\n
\n
",
"deprecated": false,
@@ -43,6 +45,7 @@
"description": "'a'
or 'b'
.
\n"
}
],
+ "since": "",
"returns": "string",
"examples": "tsfaker.literalUnionParamMethod(value: 'a' | 'b' | string): string\n
\n
",
"deprecated": false,
@@ -53,6 +56,7 @@
"title": "Method With Deprecated",
"description": "Test with deprecated and see marker.
\n",
"parameters": [],
+ "since": "",
"returns": "number",
"examples": "tsfaker.methodWithDeprecated(): number\n
\n
",
"deprecated": true,
@@ -63,6 +67,7 @@
"title": "Method With Example",
"description": "Test with example marker.
\n",
"parameters": [],
+ "since": "",
"returns": "number",
"examples": "tsfaker.methodWithExample(): number\ntest.apidoc.methodWithExample() // 0\n
\n
",
"deprecated": false,
@@ -73,6 +78,7 @@
"title": "Method With Multiple See Markers",
"description": "Test with multiple see markers.
\n",
"parameters": [],
+ "since": "",
"returns": "number",
"examples": "tsfaker.methodWithMultipleSeeMarkers(): number\n
\n
",
"deprecated": false,
@@ -81,6 +87,17 @@
"test.apidoc.methodWithDeprecated()"
]
},
+ "methodWithSinceMarker": {
+ "name": "methodWithSinceMarker",
+ "title": "Method With Since Marker",
+ "description": "Test with since marker.
\n",
+ "parameters": [],
+ "since": "1.0.0",
+ "returns": "number",
+ "examples": "tsfaker.methodWithSinceMarker(): number\n
\n
",
+ "deprecated": false,
+ "seeAlsos": []
+ },
"multiParamMethod": {
"name": "multiParamMethod",
"title": "Multi Param Method",
@@ -103,6 +120,7 @@
"description": "The boolean parameter.
\n"
}
],
+ "since": "",
"returns": "number",
"examples": "tsfaker.multiParamMethod(a: number, b?: string, c: boolean = true): number\n
\n
",
"deprecated": false,
@@ -113,6 +131,7 @@
"title": "No Param Method",
"description": "Test with no parameters.
\n",
"parameters": [],
+ "since": "",
"returns": "number",
"examples": "tsfaker.noParamMethod(): number\n
\n
",
"deprecated": false,
@@ -129,6 +148,7 @@
"description": "The string parameter.
\n"
}
],
+ "since": "",
"returns": "number",
"examples": "tsfaker.optionalStringParamMethod(b?: string): number\n
\n
",
"deprecated": false,
@@ -173,6 +193,7 @@
"description": "The number parameter. It also has a more complex description.
\n"
}
],
+ "since": "",
"returns": "number",
"examples": "tsfaker.optionsInlineParamMethodWithDefaults(a: {\n value: number\n} = { value: 1 }, b: {\n value: number\n} = { value: 1 }, c: {\n value: number\n}): number\n
\n
",
"deprecated": false,
@@ -201,6 +222,7 @@
"description": "Parameter with inner jsdocs default.
\n"
}
],
+ "since": "",
"returns": "number",
"examples": "tsfaker.optionsInterfaceParamMethodWithDefaults(a: ParameterOptionsInterfaceA = { value: 1 }, b: ParameterOptionsInterfaceB = { value: 1 }, c: ParameterOptionsInterfaceC): number\n
\n
",
"deprecated": false,
@@ -237,6 +259,7 @@
"description": "The method parameter.
\n"
}
],
+ "since": "",
"returns": "number",
"examples": "tsfaker.optionsParamMethod(options: {\n a: number,\n b: string,\n c: boolean,\n d: () => string\n}): number\n
\n
",
"deprecated": false,
@@ -265,6 +288,7 @@
"description": "Parameter with inner jsdocs default.
\n"
}
],
+ "since": "",
"returns": "number",
"examples": "tsfaker.optionsTypeParamMethodWithDefaults(a: ParameterOptionsTypeA = { value: 1 }, b: ParameterOptionsTypeB = { value: 1 }, c: ParameterOptionsTypeC): number\n
\n
",
"deprecated": false,
@@ -281,6 +305,7 @@
"description": "The number parameter.
\n"
}
],
+ "since": "",
"returns": "number",
"examples": "tsfaker.requiredNumberParamMethod(a: number): number\n
\n
",
"deprecated": false,
@@ -297,6 +322,7 @@
"description": "'a'
or 'b'
.
\n"
}
],
+ "since": "",
"returns": "string",
"examples": "tsfaker.stringUnionParamMethod(value: 'a' | 'b'): string\n
\n
",
"deprecated": false,