You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a simple substring that will return only the first character.
If you pass AB without space, it will calculate length to 1 and it will also return only first character.
So the only working way to use custom initials is to pass correct length via function args.
Solution is to split every character instead of splitting by space in line 32.
The text was updated successfully, but these errors were encountered:
After looking more closely at the code, I agree with you that line 32 should be .split('') instead of .split(' '). We'd super welcome a PR for this if you're open to a community contribution!
In
https://github.com/elastic/eui/blob/main/src/services/string/to_initials.ts
Custom initials in the line 32 are split by whitespace
https://github.com/elastic/eui/blob/main/src/services/string/to_initials.ts#L32
to calculate length.
So if you pass
A B
, length will be calculated to2
.However, on the line 49:
https://github.com/elastic/eui/blob/main/src/services/string/to_initials.ts#L49
There is a simple substring that will return only the first character.
If you pass
AB
without space, it will calculate length to1
and it will also return only first character.So the only working way to use custom initials is to pass correct length via function args.
Solution is to split every character instead of splitting by space in line 32.
The text was updated successfully, but these errors were encountered: