Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to exclude emoji #2623

Open
nuotsu opened this issue Jan 25, 2024 · 8 comments · May be fixed by #2851
Open

Add option to exclude emoji #2623

nuotsu opened this issue Jan 25, 2024 · 8 comments · May be fixed by #2851
Labels
c: feature Request for new feature has workaround Workaround provided or linked m: person Something is referring to the person module p: 1-normal Nothing urgent s: waiting for user interest Waiting for more users interested in this feature
Milestone

Comments

@nuotsu
Copy link

nuotsu commented Jan 25, 2024

Clear and concise description of the problem

Please add an option to exclude emojis in faker.person.bio(). Would like to avoid having to write a script to remove/replace emojis when they are generated.

Suggested solution

Perhaps one of 2 methods (or both):

  1. Pass options to bio()
faker.person.bio({ emojis: false })
  1. New method
faker.person.bioWithoutEmoji()

Alternative

No response

Additional context

No response

@nuotsu nuotsu added c: feature Request for new feature s: pending triage Pending Triage s: waiting for user interest Waiting for more users interested in this feature labels Jan 25, 2024
Copy link

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

View more issues which are waiting for user interest

@ST-DDT
Copy link
Member

ST-DDT commented Jan 25, 2024

Could you please explain what exactly bothers you with the emojis (just so we understand what exactly we have to implement/change)?
Do you want just plain text? What about emoji text ¯\_(ツ)_/¯?

Please remember to upvote your own feature request😉

@nuotsu
Copy link
Author

nuotsu commented Jan 26, 2024

Currently using faker to generate medium to long phrases of text (fake LLM promps) and the emojis stand out, visually.

Do you want just plain text? What about emoji text ¯_(ツ)_/¯?

My preference is plain text, but I think others may like the option for emoji text / ASCII.

In which case the former suggestion might be better off:

faker.person.bio({ emoji: '...' })

type BioOptions = {
  emoji?: 'unicode' | 'text' | 'ascii' | 'none' | false // etc
}

@ST-DDT ST-DDT added p: 1-normal Nothing urgent m: person Something is referring to the person module and removed s: pending triage Pending Triage labels Jan 26, 2024
@ST-DDT ST-DDT added this to the vFuture milestone Jan 26, 2024
@matthewmayer
Copy link
Contributor

Maybe a helper function which strips emojis, or non ascii text would be more genetically useful than adding a parameter to this method specifically?

@xDivisionByZerox
Copy link
Member

Maybe a helper function which strips emojis, or non ascii text would be more genetically useful than adding a parameter to this method specifically?

May you explain how a second, separate method can be more generic than making the signature allow options that customize the output? Allowing custom output by parameters is literally the most generic option there is. Might nit be the best in terms of DX, but I don't see where you come from with your argument and want to understand it.

@matthewmayer
Copy link
Contributor

Because other methods might emit emoji or non ascii characters, not just this one.

@ST-DDT
Copy link
Member

ST-DDT commented Jan 26, 2024

I'm not sure about removing certain things from our strings or providing a separate method for that.
Because if we add that, why don't we have a method to remove all as from the value?

I think having a parameter is different because we could control which parts we would like to add to the output, but I'm not even sure I would like to do that. (Only if there is community interest for it)

As a workaround you could strip the emojis from the patterns:

faker.rawDefintions.person.bio_pattern = faker.rawDefintions.person.bio_pattern.map((v) => v.replaceAll("{{internet.emoji}}", "");

@ST-DDT ST-DDT added the has workaround Workaround provided or linked label Jan 26, 2024
@matthewmayer
Copy link
Contributor

matthewmayer commented Jan 26, 2024

As another workaround you can easily strip emojis from a string using Unicode property escapes:

faker.person.bio().replace(/\p{Emoji}/gu, '');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: feature Request for new feature has workaround Workaround provided or linked m: person Something is referring to the person module p: 1-normal Nothing urgent s: waiting for user interest Waiting for more users interested in this feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants