-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat(ui-library): made ids optional and provided fallback #641
Conversation
// the bitwise OR replaces Math.floor which is much faster, | ||
// but will fail on very large numbers, which is not the case here | ||
if (validFirstChar) { | ||
return characters.charAt((Math.random() * validFirstCharactersLength) | 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I assume that the first character can never be a number which is why you have this check in place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, exactly.- according to specs, it has to start with letters.
there are more characters allowed here actually (dash for example) but its fine like this i guess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code was from stackover flow bad had that issue, i just optimized it and fixed it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you ever foresee a scenario where the user would want to provide their own id?
No description provided.