properCase.js 345 B

12345678910111213
  1. var toString = require('../lang/toString');
  2. var lowerCase = require('./lowerCase');
  3. var upperCase = require('./upperCase');
  4. /**
  5. * UPPERCASE first char of each word.
  6. */
  7. function properCase(str){
  8. str = toString(str);
  9. return lowerCase(str).replace(/^\w|\s\w/g, upperCase);
  10. }
  11. module.exports = properCase;