aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2024-09-20 08:16:44 +0200
committerGitHub <[email protected]>2024-09-20 08:16:44 +0200
commitdfbf6c4fb755ae57f1c4b9ddc79898b192006188 (patch)
tree111570de280a76350bdd70877aac6dc7bf1a6306 /src/modules
parentf27f9c5cb8173e577fa61c4e1766856fbea3fcf1 (diff)
downloadfaker-dfbf6c4fb755ae57f1c4b9ddc79898b192006188.tar.xz
faker-dfbf6c4fb755ae57f1c4b9ddc79898b192006188.zip
refactor(image): deprecate avatarLegacy (#3109)
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/image/index.ts19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/modules/image/index.ts b/src/modules/image/index.ts
index 02b3c31c..93a0adf9 100644
--- a/src/modules/image/index.ts
+++ b/src/modules/image/index.ts
@@ -1,3 +1,4 @@
+import { deprecated } from '../../internal/deprecated';
import { ModuleBase } from '../../internal/module-base';
/**
@@ -24,12 +25,8 @@ export class ImageModule extends ModuleBase {
* @since 2.0.1
*/
avatar(): string {
- const avatarMethod = this.faker.helpers.arrayElement([
- this.avatarLegacy,
- this.avatarGitHub,
- ]);
-
- return avatarMethod();
+ // Add new avatar providers here, when adding a new one.
+ return this.avatarGitHub();
}
/**
@@ -55,9 +52,17 @@ export class ImageModule extends ModuleBase {
* // 'https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/170.jpg'
*
* @since 8.0.0
+ *
+ * @deprecated The links are no longer working. Use `avatar()` instead.
*/
- // This implementation will change in the future when we tackle https://github.com/faker-js/faker/issues/465.
avatarLegacy(): string {
+ deprecated({
+ deprecated: 'faker.image.avatarLegacy()',
+ proposed: 'faker.image.avatar()',
+ since: '9.0.1',
+ until: '10.0.0',
+ });
+
return `https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/${this.faker.number.int(
1249
)}.jpg`;