File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
packages/eui/src/services/string Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 66 * Side Public License, v 1.
77 */
88
9+ export const MAX_INITIALS = 2 ;
10+
911/**
1012 * This function calculates the initials/acronym for a given name.
1113 * It defaults to only 2 characters and will take the first character (of each word).
1719 * @param {string } name The full name of the item to turn into initials
1820 * @param {number } initialsLength (Optional) How many characters to show (max 2 allowed)
1921 * @param {string } initials (Optional) Custom initials (max 2 characters)
20- * @returns {string } True if the color is dark, false otherwise.
2122 */
22-
23- export const MAX_INITIALS = 2 ;
24-
2523export function toInitials (
2624 name : string ,
2725 initialsLength ?: 1 | 2 ,
2826 initials ?: string
29- ) : string | null {
27+ ) {
3028 // If `initials` provided, check if it's a single emoji
3129 // in order to support complex, "multi-character" ones
3230 if ( initials ) {
@@ -71,7 +69,7 @@ export function toInitials(
7169 }
7270 }
7371
74- return calculatedInitials ;
72+ return calculatedInitials || '' ;
7573}
7674
7775function isEmoji ( str : string ) : boolean {
You can’t perform that action at this time.
0 commit comments