A typescript function that converts a string to Title Case

PHOTO EMBED

Wed Dec 22 2021 21:09:27 GMT+0000 (UTC)

Saved by @dejohnny #typescript

export function toTitleCase(str: string) {
  return str.toLowerCase().replace(/\b(\w)/g, s => s.toUpperCase());
}
content_copyCOPY