# upperCase
# Description
转换字符串 string 为 空格 分隔的大写单词。
# Params
string
# Return
string
# Depend
import words from './words.js'
import toString from './toString.js'
# Code
const upperCase = (string) => (
words(toString(string).replace(/['\u2019]/g, '')).reduce((result, word, index) => (
result + (index ? ' ' : '') + word.toUpperCase()
), '')
)
# Analyze
和 kebabCase 类似,只不过拼接换成了空格,转小写换成了转大写
# Example
console.log(upperCase('upperCase')) // UPPER CASE
← updateWith upperFirst →