MCPcopy
hub / github.com/faker-js/faker / avatar

Method avatar

src/modules/image/index.ts:34–41  ·  view source on GitHub ↗

* Generates a random avatar image url. * * @remark This method sometimes generates a random string representing an URL from GitHub by using a random user ID. Faker is not responsible for the content of the image or the service providing it. * * @example * faker.image.avatar() * //

()

Source from the content-addressed store, hash-verified

32 * @since 2.0.1
33 */
34 avatar(): string {
35 // Add new avatar providers here, when adding a new one.
36 const avatarMethod = this.faker.helpers.arrayElement([
37 this.personPortrait,
38 this.avatarGitHub,
39 ]);
40 return avatarMethod();
41 }
42
43 /**
44 * Generates a random avatar from GitHub.

Callers 2

image.spec.tsFile · 0.80
image.spec.tsFile · 0.80

Calls 1

arrayElementMethod · 0.80

Tested by

no test coverage detected