feat: add common-utils (#2374)

This commit is contained in:
Henry Wang
2019-06-12 04:09:27 +01:00
committed by DIYgod
parent 07ce725bf4
commit 4531de80f9
4 changed files with 35 additions and 16 deletions

11
lib/utils/common-utils.js Normal file
View File

@@ -0,0 +1,11 @@
// convert a string into title case
const toTitleCase = (str) =>
str
.toLowerCase()
.split(' ')
.map((word) => word.replace(word[0], word[0].toUpperCase()))
.join(' ');
module.exports = {
toTitleCase,
};