From 48a7af4f0470115945ab166b540d0bedc7e5eb20 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Mon, 6 Nov 2023 09:40:49 +0100 Subject: refactor: simplify module creation (#2485) --- src/modules/image/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/modules/image') diff --git a/src/modules/image/index.ts b/src/modules/image/index.ts index b1c9c692..915014db 100644 --- a/src/modules/image/index.ts +++ b/src/modules/image/index.ts @@ -1,6 +1,6 @@ import type { Faker } from '../..'; -import { bindThisToMemberFunctions } from '../../internal/bind-this-to-member-functions'; import { deprecated } from '../../internal/deprecated'; +import { ModuleBase } from '../../internal/module-base'; import type { MethodsOf } from '../../utils/types'; import { LoremPicsum } from './providers/lorempicsum'; import { Placeholder } from './providers/placeholder'; @@ -19,7 +19,7 @@ import { Unsplash } from './providers/unsplash'; * * This module previously also contained methods for specifically themed images like "fashion" or "food", but these are now deprecated. If you need more control over image type, you can request categorized images using [`urlLoremFlickr()`](https://fakerjs.dev/api/image.html#urlloremflickr), use an image provider directly or provide your own set of placeholder images. */ -export class ImageModule { +export class ImageModule extends ModuleBase { /** * @deprecated Use `faker.image` instead. */ @@ -38,8 +38,8 @@ export class ImageModule { // eslint-disable-next-line deprecation/deprecation readonly placeholder: Placeholder; - constructor(private readonly faker: Faker) { - bindThisToMemberFunctions(this); + constructor(faker: Faker) { + super(faker); // eslint-disable-next-line deprecation/deprecation this.unsplash = new Unsplash(this.faker); -- cgit v1.2.3