add capitalizeFirstLetter utility
This commit is contained in:
@@ -31,7 +31,8 @@ export {
|
|||||||
type IconDef,
|
type IconDef,
|
||||||
getLabel,
|
getLabel,
|
||||||
getValue,
|
getValue,
|
||||||
defaultIconProps
|
defaultIconProps,
|
||||||
|
capitalizeFirstLetter
|
||||||
} from './util';
|
} from './util';
|
||||||
export {
|
export {
|
||||||
type ToolbarToggleState,
|
type ToolbarToggleState,
|
||||||
|
|||||||
@@ -87,3 +87,9 @@ export function targetMust<T extends HTMLElement>(event: Event): T {
|
|||||||
}
|
}
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** capitalizeFirstLetter capitalizes the first letter of a string */
|
||||||
|
export const capitalizeFirstLetter = (str: string): string => {
|
||||||
|
const lower = str.toLowerCase();
|
||||||
|
return lower.charAt(0).toUpperCase() + lower.slice(1);
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user