'use strict';

/**
 * 单词首字母大写
 * @param srcStr : string
 *
 * capitalize();          // => ''
 * capitalize('');        // => ''
 * capitalize(undefined); // => ''
 * capitalize('hello');   // => 'Hello'
 * capitalize(null);      // => 'Null'
 * capitalize(true);      // => 'True'
 * capitalize(false);     // => 'False'
 */
function capitalize(word) {
  return String(word || '').replace(/^[a-z]/, function (letter) {
    return letter.toUpperCase();
  });
}

module.exports = capitalize;
