Files
lodash/capitalize.js
2018-11-12 23:14:08 -08:00

20 lines
439 B
JavaScript

import upperFirst from './upperFirst.js'
/**
* Converts the first character of `string` to upper case and the remaining
* to lower case.
*
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to capitalize.
* @returns {string} Returns the capitalized string.
* @example
*
* capitalize('FRED')
* // => 'Fred'
*/
const capitalize = (string) => upperFirst(string.toLowerCase())
export default capitalize