webapp/src/utils/capitalize.ts
Kosta 85e8533931
dates in notifications, lots of minor fixes (#271)
* dates in notifications, lots of minor fixes
Co-authored-by: Igor Lobanov <igor.lobanov@onetwotrip.com>
2023-10-18 13:56:41 +03:00

10 lines
282 B
TypeScript

export const capitalize = (originalString: string, firstonly = false) => {
const s = originalString.trim()
return firstonly
? s.charAt(0).toUpperCase() + s.slice(1)
: s
.split(' ')
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
.join(' ')
}