Open Noitidart opened 5 years ago
Could you give an example when you’d prefer two characters over one character per word?
Thanks @gr2m for such an amazingly fast reply!!
The avatars in my app can't fit more than two chars, especially the mini avatars at the right, here is a screenshot:
That makes sense.
I’d say it depends on how much added complexity would be needed to add that feature. Would you like to start a pull request with a failing test and we take it from there?
If it would require too many changes, it would probably make sense for you to fork the repository. It is fairly simple as is right now, and in the years of its existence you are the first to ask about this particular feature
Absolutely I would love to contribute! I love team work. I'll start with that test. Thanks for helping me get involved!
Do you know how others handle situations where the initials get too long?
Do you know how others handle situations where the initials get too long?
I haven’t heard of anyone else who run into this situation. I think you have a new use case here :)
hahah my users are freaks with more than two names. jk jk my users if you read this! i love you all!
On Tue, May 14, 2019 at 9:26 AM Gregor Martynus notifications@github.com wrote:
Do you know how others handle situations where the initials get too long?
I haven’t heard of anyone else who run into this situation. I think you have a new use case here :)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gr2m/initials/issues/58?email_source=notifications&email_token=ABQTZCNPXEHT4Z5BU2JEY2TPVLRZVA5CNFSM4HMVQ5EKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVMA4TI#issuecomment-492310093, or mute the thread https://github.com/notifications/unsubscribe-auth/ABQTZCPRFY5T6KDNJJNLYE3PVLRZVANCNFSM4HMVQ5EA .
This is a very common use case actually. All avatar fallbacks in apps only show two letters if there isn't an image available.
See https://stackoverflow.com/questions/33076177/getting-name-initials-using-js for a quick snippet.
Hi @Noitidart, I have the same use case of limiting it to 2 chars, can you comment if you found the work around for limiting it to two characters ?
I'd be happy to accept a pull request if the resulting bundle remains under 1.5kb minified and gzipped: https://bundlephobia.com/result?p=initials@3.0.1
@m-nathani what I did was create the initials, then do a length check on the result. If it's more than 2, then I would just take the first and last character.
Is it possible to limit initials to two characters? while maintaining the "uniqueness", of course until all permutations exhausted.