aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorShinigami <[email protected]>2022-09-09 01:18:57 +0800
committerGitHub <[email protected]>2022-09-08 17:18:57 +0000
commitb9884d098d6e14001da36acfba6fbfebdcef8fea (patch)
tree255dc8698618dfdb0de268f6f3db9bca94b84e83 /src/modules
parent1fe2877d0c6b237b3d1a5b6b29c4749578a8f9a4 (diff)
downloadfaker-b9884d098d6e14001da36acfba6fbfebdcef8fea.tar.xz
faker-b9884d098d6e14001da36acfba6fbfebdcef8fea.zip
feat(modules): export module interfaces (#932)
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/address/index.ts4
-rw-r--r--src/modules/animal/index.ts4
-rw-r--r--src/modules/color/index.ts4
-rw-r--r--src/modules/commerce/index.ts4
-rw-r--r--src/modules/company/index.ts4
-rw-r--r--src/modules/database/index.ts4
-rw-r--r--src/modules/datatype/index.ts4
-rw-r--r--src/modules/date/index.ts6
-rw-r--r--src/modules/fake/index.ts4
-rw-r--r--src/modules/finance/index.ts4
-rw-r--r--src/modules/git/index.ts4
-rw-r--r--src/modules/hacker/index.ts4
-rw-r--r--src/modules/helpers/index.ts4
-rw-r--r--src/modules/image/index.ts6
-rw-r--r--src/modules/internet/index.ts4
-rw-r--r--src/modules/lorem/index.ts6
-rw-r--r--src/modules/mersenne/index.ts4
-rw-r--r--src/modules/music/index.ts4
-rw-r--r--src/modules/name/index.ts4
-rw-r--r--src/modules/phone/index.ts4
-rw-r--r--src/modules/random/index.ts4
-rw-r--r--src/modules/science/index.ts4
-rw-r--r--src/modules/system/index.ts4
-rw-r--r--src/modules/unique/index.ts4
-rw-r--r--src/modules/vehicle/index.ts4
-rw-r--r--src/modules/word/index.ts4
26 files changed, 54 insertions, 56 deletions
diff --git a/src/modules/address/index.ts b/src/modules/address/index.ts
index 7f8660cd..695d8249 100644
--- a/src/modules/address/index.ts
+++ b/src/modules/address/index.ts
@@ -4,10 +4,10 @@ import { deprecated } from '../../internal/deprecated';
/**
* Module to generate addresses and locations.
*/
-export class Address {
+export class AddressModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Address.prototype)) {
+ for (const name of Object.getOwnPropertyNames(AddressModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/animal/index.ts b/src/modules/animal/index.ts
index c9b91451..4a0af052 100644
--- a/src/modules/animal/index.ts
+++ b/src/modules/animal/index.ts
@@ -3,10 +3,10 @@ import type { Faker } from '../..';
/**
* Module to generate animal related entries.
*/
-export class Animal {
+export class AnimalModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Animal.prototype)) {
+ for (const name of Object.getOwnPropertyNames(AnimalModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/color/index.ts b/src/modules/color/index.ts
index 4b976098..c6dbb0a4 100644
--- a/src/modules/color/index.ts
+++ b/src/modules/color/index.ts
@@ -154,10 +154,10 @@ function toColorFormat(
/**
* Module to generate colors.
*/
-export class Color {
+export class ColorModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Color.prototype)) {
+ for (const name of Object.getOwnPropertyNames(ColorModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/commerce/index.ts b/src/modules/commerce/index.ts
index 876545e0..11ed8d7b 100644
--- a/src/modules/commerce/index.ts
+++ b/src/modules/commerce/index.ts
@@ -4,10 +4,10 @@ import { deprecated } from '../../internal/deprecated';
/**
* Module to generate commerce and product related entries.
*/
-export class Commerce {
+export class CommerceModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Commerce.prototype)) {
+ for (const name of Object.getOwnPropertyNames(CommerceModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/company/index.ts b/src/modules/company/index.ts
index b07b2a93..2b17a6ed 100644
--- a/src/modules/company/index.ts
+++ b/src/modules/company/index.ts
@@ -4,10 +4,10 @@ import { deprecated } from '../../internal/deprecated';
/**
* Module to generate company related entries.
*/
-export class Company {
+export class CompanyModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Company.prototype)) {
+ for (const name of Object.getOwnPropertyNames(CompanyModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/database/index.ts b/src/modules/database/index.ts
index 87494315..8a4291f9 100644
--- a/src/modules/database/index.ts
+++ b/src/modules/database/index.ts
@@ -3,10 +3,10 @@ import type { Faker } from '../..';
/**
* Module to generate database related entries.
*/
-export class Database {
+export class DatabaseModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Database.prototype)) {
+ for (const name of Object.getOwnPropertyNames(DatabaseModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/datatype/index.ts b/src/modules/datatype/index.ts
index 1a516736..9991175d 100644
--- a/src/modules/datatype/index.ts
+++ b/src/modules/datatype/index.ts
@@ -5,10 +5,10 @@ import { deprecated } from '../../internal/deprecated';
/**
* Module to generate various primitive values and data types.
*/
-export class Datatype {
+export class DatatypeModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Datatype.prototype)) {
+ for (const name of Object.getOwnPropertyNames(DatatypeModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/date/index.ts b/src/modules/date/index.ts
index 0ca11d45..111fc4ba 100644
--- a/src/modules/date/index.ts
+++ b/src/modules/date/index.ts
@@ -20,12 +20,10 @@ function toDate(date?: string | Date | number): Date {
/**
* Module to generate dates.
*/
-// disabled until modules are renamed to something with a suffix
-// eslint-disable-next-line @typescript-eslint/naming-convention
-export class _Date {
+export class DateModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(_Date.prototype)) {
+ for (const name of Object.getOwnPropertyNames(DateModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/fake/index.ts b/src/modules/fake/index.ts
index c3e31253..94ad4325 100644
--- a/src/modules/fake/index.ts
+++ b/src/modules/fake/index.ts
@@ -6,10 +6,10 @@ import { deprecated } from '../../internal/deprecated';
*
* @deprecated
*/
-export class Fake {
+export class FakeModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Fake.prototype)) {
+ for (const name of Object.getOwnPropertyNames(FakeModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/finance/index.ts b/src/modules/finance/index.ts
index 87700c86..d1580603 100644
--- a/src/modules/finance/index.ts
+++ b/src/modules/finance/index.ts
@@ -5,10 +5,10 @@ import iban from './iban';
/**
* Module to generate finance related entries.
*/
-export class Finance {
+export class FinanceModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Finance.prototype)) {
+ for (const name of Object.getOwnPropertyNames(FinanceModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/git/index.ts b/src/modules/git/index.ts
index da1dfab7..d92e3454 100644
--- a/src/modules/git/index.ts
+++ b/src/modules/git/index.ts
@@ -3,10 +3,10 @@ import type { Faker } from '../..';
/**
* Module to generate git related entries.
*/
-export class Git {
+export class GitModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Git.prototype)) {
+ for (const name of Object.getOwnPropertyNames(GitModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/hacker/index.ts b/src/modules/hacker/index.ts
index ea36fc0e..d842d74e 100644
--- a/src/modules/hacker/index.ts
+++ b/src/modules/hacker/index.ts
@@ -3,10 +3,10 @@ import type { Faker } from '../..';
/**
* Module to generate hacker/IT words and phrases.
*/
-export class Hacker {
+export class HackerModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Hacker.prototype)) {
+ for (const name of Object.getOwnPropertyNames(HackerModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/helpers/index.ts b/src/modules/helpers/index.ts
index 9e9a3f5b..f6aa55ac 100644
--- a/src/modules/helpers/index.ts
+++ b/src/modules/helpers/index.ts
@@ -9,10 +9,10 @@ import * as uniqueExec from './unique';
* Module with various helper methods that transform the method input rather than returning values from locales.
* The transformation process may call methods that use the locale data.
*/
-export class Helpers {
+export class HelpersModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Helpers.prototype)) {
+ for (const name of Object.getOwnPropertyNames(HelpersModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/image/index.ts b/src/modules/image/index.ts
index 082f7e73..1a709505 100644
--- a/src/modules/image/index.ts
+++ b/src/modules/image/index.ts
@@ -10,7 +10,7 @@ import { Unsplash } from './providers/unsplash';
*
* Default provider is unsplash image provider.
*/
-export class Image {
+export class ImageModule {
readonly lorempixel: Lorempixel;
readonly unsplash: Unsplash;
readonly lorempicsum: LoremPicsum;
@@ -18,7 +18,7 @@ export class Image {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Image.prototype)) {
+ for (const name of Object.getOwnPropertyNames(ImageModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
@@ -46,7 +46,7 @@ export class Image {
* @since 2.0.1
*/
image(width?: number, height?: number, randomize?: boolean): string {
- const categories: MethodsOf<Image, Image['image']> = [
+ const categories: MethodsOf<ImageModule, ImageModule['image']> = [
'abstract',
'animals',
'business',
diff --git a/src/modules/internet/index.ts b/src/modules/internet/index.ts
index 724c35dc..2da5b59f 100644
--- a/src/modules/internet/index.ts
+++ b/src/modules/internet/index.ts
@@ -23,10 +23,10 @@ export type HTTPStatusCodeType =
/**
* Module to generate internet related entries.
*/
-export class Internet {
+export class InternetModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Internet.prototype)) {
+ for (const name of Object.getOwnPropertyNames(InternetModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/lorem/index.ts b/src/modules/lorem/index.ts
index e086751d..4745b0e9 100644
--- a/src/modules/lorem/index.ts
+++ b/src/modules/lorem/index.ts
@@ -3,10 +3,10 @@ import type { Faker } from '../..';
/**
* Module to generate random texts and words.
*/
-export class Lorem {
+export class LoremModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Lorem.prototype)) {
+ for (const name of Object.getOwnPropertyNames(LoremModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
@@ -181,7 +181,7 @@ export class Lorem {
* @since 3.1.0
*/
text(): string {
- const methods: Array<keyof Lorem> = [
+ const methods: Array<keyof LoremModule> = [
'word',
'words',
'sentence',
diff --git a/src/modules/mersenne/index.ts b/src/modules/mersenne/index.ts
index f03c137d..5f60e867 100644
--- a/src/modules/mersenne/index.ts
+++ b/src/modules/mersenne/index.ts
@@ -4,14 +4,14 @@ import Gen from './twister';
/**
* Module to generate seed based random numbers.
*/
-export class Mersenne {
+export class MersenneModule {
private gen = new Gen();
constructor() {
this.gen.initGenrand(new Date().getTime() % 1000000000);
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Mersenne.prototype)) {
+ for (const name of Object.getOwnPropertyNames(MersenneModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/music/index.ts b/src/modules/music/index.ts
index a03e76cb..482ee2b0 100644
--- a/src/modules/music/index.ts
+++ b/src/modules/music/index.ts
@@ -3,10 +3,10 @@ import type { Faker } from '../..';
/**
* Module to generate music related entries.
*/
-export class Music {
+export class MusicModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Music.prototype)) {
+ for (const name of Object.getOwnPropertyNames(MusicModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/name/index.ts b/src/modules/name/index.ts
index c524b64b..bdd3bd37 100644
--- a/src/modules/name/index.ts
+++ b/src/modules/name/index.ts
@@ -75,10 +75,10 @@ function selectDefinition(
/**
* Module to generate people's names and titles.
*/
-export class Name {
+export class NameModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Name.prototype)) {
+ for (const name of Object.getOwnPropertyNames(NameModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/phone/index.ts b/src/modules/phone/index.ts
index 2571014d..1f0d16a3 100644
--- a/src/modules/phone/index.ts
+++ b/src/modules/phone/index.ts
@@ -4,10 +4,10 @@ import { deprecated } from '../../internal/deprecated';
/**
* Module to generate phone-related data.
*/
-export class Phone {
+export class PhoneModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Phone.prototype)) {
+ for (const name of Object.getOwnPropertyNames(PhoneModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/random/index.ts b/src/modules/random/index.ts
index 8a788d9f..b4034343 100644
--- a/src/modules/random/index.ts
+++ b/src/modules/random/index.ts
@@ -97,10 +97,10 @@ function arrayRemove<T>(arr: T[], values: readonly T[]): T[] {
/**
* Generates random values of different kinds.
*/
-export class Random {
+export class RandomModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Random.prototype)) {
+ for (const name of Object.getOwnPropertyNames(RandomModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/science/index.ts b/src/modules/science/index.ts
index 1f685adb..51203a3a 100644
--- a/src/modules/science/index.ts
+++ b/src/modules/science/index.ts
@@ -32,10 +32,10 @@ export interface Unit {
/**
* Module to generate science related entries.
*/
-export class Science {
+export class ScienceModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Science.prototype)) {
+ for (const name of Object.getOwnPropertyNames(ScienceModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/system/index.ts b/src/modules/system/index.ts
index 3700a2d8..860ab7b9 100644
--- a/src/modules/system/index.ts
+++ b/src/modules/system/index.ts
@@ -35,10 +35,10 @@ const CRON_DAY_OF_WEEK = [
/**
* Generates fake data for many computer systems properties.
*/
-export class System {
+export class SystemModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(System.prototype)) {
+ for (const name of Object.getOwnPropertyNames(SystemModule.prototype)) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
diff --git a/src/modules/unique/index.ts b/src/modules/unique/index.ts
index 89c322bf..fd817ec4 100644
--- a/src/modules/unique/index.ts
+++ b/src/modules/unique/index.ts
@@ -7,10 +7,10 @@ import type { RecordKey } from '../helpers/unique';
*
* @deprecated
*/
-export class Unique {
+export class UniqueModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(Unique.prototype)) {
+ for (const name of Object.getOwnPropertyNames(UniqueModule.prototype)) {
if (
name === 'constructor' ||
name === 'maxTime' ||
diff --git a/src/modules/vehicle/index.ts b/src/modules/vehicle/index.ts
index c38bbc59..cd01ece3 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;
}
diff --git a/src/modules/word/index.ts b/src/modules/word/index.ts
index 4faa4352..725c0c42 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;
}