faker
faker copied to clipboard
Make `internet.avatar()` sex or gender aware
Clear and concise description of the problem
I am using Faker to generate fake user profiles. I really appreciate the fact that I can give it a sex attribute to the person.firstName() so that it would give me feminine or masculine name.
However, one issue I have is I got a user who's name is John Franken but the avatar that was attached to this person is a young blonde lol. There isn't a way to make a wholistic "fake profile" without a semi-consistent image-to-name connection.
Suggested solution
Pass in sex an an argument to the avatar() method.
I understand some images can fit anything, but there are some obvious candidates as well. (see: https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/1183.jpg)
- If the picture contains both a male and a female, then it can classified as both.
- If the picture is not a person (cat, drawing, etc...) it can be classified as both
Alternative
No response
Additional context
No response
Thank you for your feature proposal.
We marked it as "waiting for user interest" for now to gather some feedback from our community:
- If you would like to see this feature be implemented, please react to the description with an up-vote (:+1:).
- If you have a suggestion or want to point out some special cases that need to be considered, please leave a comment, so we are aware about them.
We would also like to hear about other community members' use cases for the feature to give us a better understanding of their potential implicit or explicit requirements.
We will start the implementation based on:
- the number of votes (:+1:) and comments
- the relevance for the ecosystem
- availability of alternatives and workarounds
- and the complexity of the requested feature
We do this because:
- There are plenty of languages/countries out there and we would like to ensure that every method can cover all or almost all of them.
- Every feature we add to faker has "costs" associated to it:
- initial costs: design, implementation, reviews, documentation
- running costs: awareness of the feature itself, more complex module structure, increased bundle size, more work during refactors
see also discussion at https://github.com/faker-js/faker/issues/465
It would been good to have both faker.person.sex() and also faker.person.gender() to allow for fluid genders, which can randomly be mapped to sex or we have four types which can be mapped to sex via a function..
faker.person.genderToSex(gender:string):string
or introduce real types rather than enumerated types ?
faker.person.genderToSex(g:gender):sex
and for faker.person.firstName(sex:string) to take a string rather than a typed object ??? Why theres typed objects were introduced instead of strings is very odd as it requires :-
const gender = faker.person.sex();
const firstName = faker.person.firstName(gender == "male" ? "male" : "female");
Then to have a faker.person.avatar(sex:string) too.
Bear in mind locales (we want "male" and "female" in different languages) and the need for this to work easily when using vanilla JavaScript as well as typescript.
Gender pronouns would be too.
We do have an open issue for pronouns, if that interests you you can upvote https://github.com/faker-js/faker/issues/1248
Gender from faker.person.gender() maybe a string with a colon "male:female" being sex:birth_sex maybe ?
faker.person.firstName(sex:string)to take a string rather than a typed object ??? Why theres typed objects were introduced instead of strings is very odd as it requires :-const gender = faker.person.sex(); const firstName = faker.person.firstName(gender == "male" ? "male" : "female");
The code you are showing only works for English. For that reason we have introduced a method faker.person.sexType() that returns a value that will always work for that and is typed accordingly.