nishant-design-system
Version:
Sense UI components library
14 lines (11 loc) • 310 B
Flow
// @flow strict
export const capitalize = (word: string): string => {
if (!word) {
return '';
}
return word
.toLowerCase()
.replace(/\w/, (firstLetter) => firstLetter.toUpperCase());
};
export const escapeRegExp = (str: string): string =>
str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');