all files / src/utils/ titlelize.js

90% Statements 9/10
100% Branches 0/0
75% Functions 3/4
85.71% Lines 6/7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 28×                    
export function capitalize(str) {
  return str.charAt(0).toUpperCase() + str.slice(1)
}
 
export function camelize(str) {
  return str.replace(/\W+(.)/g, function (match, chr) {
    return chr.toUpperCase()
  })
}
 
export default function (str) {
  return capitalize(camelize(str))
}