diff options
| author | ST-DDT <[email protected]> | 2024-12-29 16:40:37 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-12-29 16:40:37 +0100 |
| commit | 6c13fe0a86bb44c48e20c38b1ea600f9aa39446a (patch) | |
| tree | e6bf6f531be36da426b293b1e5558d680edee8b8 /src/modules | |
| parent | eceb17d25741c5fb1bd56b8151067eed3708a076 (diff) | |
| download | faker-6c13fe0a86bb44c48e20c38b1ea600f9aa39446a.tar.xz faker-6c13fe0a86bb44c48e20c38b1ea600f9aa39446a.zip | |
refactor(image): deprecate urlPlaceholder (#3341)
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/image/index.ts | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/modules/image/index.ts b/src/modules/image/index.ts index 2eafd78b..5013bcb5 100644 --- a/src/modules/image/index.ts +++ b/src/modules/image/index.ts @@ -241,8 +241,8 @@ export class ImageModule extends ModuleBase { * Generates a random image url provided via https://via.placeholder.com/. * * @param options Options for generating a URL for an image. - * @param options.width The width of the image. Defaults to a random number between 1 and 3999. - * @param options.height The height of the image. Defaults to a random number between 1 and 3999. + * @param options.width The width of the image. Defaults to a random number between 1 and 3500. + * @param options.height The height of the image. Defaults to a random number between 1 and 3500. * @param options.backgroundColor The background color of the image. Defaults to a random hex color. * @param options.textColor The text color of the image. Defaults to a random hex color. * @param options.format The format of the image. Defaults to a random format. @@ -259,19 +259,21 @@ export class ImageModule extends ModuleBase { * faker.image.urlPlaceholder({ width: 128, height: 128, backgroundColor: '000000', textColor: 'FF0000', format: 'png', text: 'lorem ipsum' }) // 'https://via.placeholder.com/128x128/000000/FF0000.png?text=lorem+ipsum' * * @since 8.0.0 + * + * @deprecated The service has bad uptime. Use `url()` or another method instead. */ urlPlaceholder( options: { /** * The width of the image. * - * @default faker.number.int({ min: 1, max: 3999 }) + * @default faker.number.int({ min: 1, max: 3500 }) */ width?: number; /** * The height of the image. * - * @default faker.number.int({ min: 1, max: 3999 }) + * @default faker.number.int({ min: 1, max: 3500 }) */ height?: number; /** @@ -300,9 +302,16 @@ export class ImageModule extends ModuleBase { text?: string; } = {} ): string { + deprecated({ + deprecated: 'faker.image.urlPlaceholder()', + proposed: 'faker.image.url()', + since: '9.4.0', + until: '10.0.0', + }); + const { - width = this.faker.number.int({ min: 1, max: 3999 }), - height = this.faker.number.int({ min: 1, max: 3999 }), + width = this.faker.number.int({ min: 1, max: 3500 }), + height = this.faker.number.int({ min: 1, max: 3500 }), backgroundColor = this.faker.color.rgb({ format: 'hex', prefix: '' }), textColor = this.faker.color.rgb({ format: 'hex', prefix: '' }), format = this.faker.helpers.arrayElement([ |
