Skip to content

Instantly share code, notes, and snippets.

@nanotroy
Created August 28, 2019 15:51
Show Gist options
  • Save nanotroy/37f7b7ec20e22ba627dd084f0aea169d to your computer and use it in GitHub Desktop.
Save nanotroy/37f7b7ec20e22ba627dd084f0aea169d to your computer and use it in GitHub Desktop.
export const capitalize = (str) => {
if (typeof str == 'string') {
if (str == 'realestate') {
return 'Real Estate';
}
if (str == 'sundayreview') {
return 'Sunday Review';
}
if (str == 'tmagazine') {
return 'T Magazine';
}
return `${str[0].toUpperCase()}${str.slice(1)}`;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment