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

Generate random symbol (eg: ! _ #) #1711

Closed
pkuczynski opened this issue Jan 3, 2023 · 10 comments · Fixed by #1789
Closed

Generate random symbol (eg: ! _ #) #1711

pkuczynski opened this issue Jan 3, 2023 · 10 comments · Fixed by #1789
Assignees
Labels
c: refactor PR that affects the runtime behavior, but doesn't add new features or fixes bugs p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug

Comments

@pkuczynski
Copy link
Member

pkuczynski commented Jan 3, 2023

Clear and concise description of the problem

Provide a method which would generate random symbol (non alphanumeric character), for example !#_-/\.$.

Suggested solution

faker.random.symbol() // #

Alternative

No response

Additional context

No response

@pkuczynski pkuczynski added the s: pending triage Pending Triage label Jan 3, 2023
@ST-DDT
Copy link
Member

ST-DDT commented Jan 3, 2023

What is the difference to faker.string.special?
https://next.fakerjs.dev/api/string.html#special

Should we rename that method?

@pkuczynski
Copy link
Member Author

pkuczynski commented Jan 3, 2023

No difference at all! It's actually what I was looking for, but could not find it... It's also on the next branch and I was looking at the stable. But yeah, I think it should be renamed to symbol as it is more common term... string.special does not sound like it generates a symbol to me... If we want to stick to special it should be rather specialCharacters but that's more in light of passwords. symbol seems more like a general term...

By the way, why method generating UTF-16 is called sample? :)

@import-brain import-brain added c: feature Request for new feature and removed s: pending triage Pending Triage labels Jan 3, 2023
@Shinigami92
Copy link
Member

Shinigami92 commented Jan 3, 2023

We can rename it without making a breaking change, as the current released alpha is not intended to be "stable"

I would be ok with renaming it, but should it be symbol or symbols? it can generate more then one char 🤔

@pkuczynski
Copy link
Member Author

I would be ok with renaming it, but should it be symbol or symbols? it can generate more then one char 🤔

I was thinking the same, but if you look at alpha or alphanumeric - they also in a singular form. So I would keep it symbol. Especially default length is 1 (I assume)?

@pkuczynski
Copy link
Member Author

I can provide a PR if everybody agrees...

@ST-DDT
Copy link
Member

ST-DDT commented Jan 3, 2023

I'm fine with renaming.
How about symbolic? Similar to numeric?
Not sure if that conveys the correct meaning.

The jsdoc should contain both the symbol and special characters terms.

@ST-DDT ST-DDT added p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug c: refactor PR that affects the runtime behavior, but doesn't add new features or fixes bugs and removed c: feature Request for new feature labels Jan 3, 2023
@ST-DDT ST-DDT added this to the v8.0 - Module Re-Shuffling milestone Jan 3, 2023
@ST-DDT ST-DDT moved this to Todo in Faker Roadmap Jan 3, 2023
@import-brain
Copy link
Member

I would be ok with renaming it, but should it be symbol or symbols? it can generate more then one char 🤔

I was thinking the same, but if you look at alpha or alphanumeric - they also in a singular form. So I would keep it symbol. Especially default length is 1 (I assume)?

I would also keep it as symbol, considering the other methods are in singular form.

@matthewmayer
Copy link
Contributor

FWIW i think the documentation should list out what "special" characters this pulls from. Only simple punctation marks? Spaces? Dingbats and emojis? Accented letters? The list seems short enough you could just list them explicitly.

! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~

@xDivisionByZerox
Copy link
Member

xDivisionByZerox commented Jan 28, 2023

@pkuczynski Are you still interested in providing a PR for this Issue (or even already working on it)? Since this is blocking for v8 I'd like to not keep this around any longer.

@pkuczynski
Copy link
Member Author

Go ahead. I am still tied with my personal life :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: refactor PR that affects the runtime behavior, but doesn't add new features or fixes bugs p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

6 participants