mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 14:37:49 +00:00
27 lines
649 B
JavaScript
27 lines
649 B
JavaScript
import createCompounder from './.internal/createCompounder.js'
|
|
|
|
/**
|
|
* Converts `string`, as space separated words, to upper case.
|
|
*
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the upper cased string.
|
|
* @see camelCase, kebabCase, lowerCase, snakeCase, startCase, upperFirst
|
|
* @example
|
|
*
|
|
* upperCase('--foo-bar')
|
|
* // => 'FOO BAR'
|
|
*
|
|
* upperCase('fooBar')
|
|
* // => 'FOO BAR'
|
|
*
|
|
* upperCase('__foo_bar__')
|
|
* // => 'FOO BAR'
|
|
*/
|
|
const upperCase = createCompounder((result, word, index) =>
|
|
result + (index ? ' ' : '') + word.toUpperCase()
|
|
)
|
|
|
|
export default upperCase
|