Sha256: 5600fbfb9fb6c6492bd2275e7f9b56ab56467068b0f8335c78fbad154ed5f379

Contents?: true

Size: 364 Bytes

Versions: 4

Compression:

Stored size: 364 Bytes

Contents

function titleize(sentence) {
    if(!sentence.split) return sentence

    const titleizedWord = function(string) {
        return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase()
    }

    let result = []
    sentence.split(' ').forEach(function(w) {
        result.push(titleizedWord(w))
    })

    return result.join(' ')
}

export { titleize }

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
playbook_ui-3.0.1 app/pb_kits/playbook/utilities/text.js
playbook_ui-3.0.0 app/pb_kits/playbook/utilities/text.js
playbook_ui-2.9.9 app/pb_kits/playbook/utilities/text.js
playbook_ui-2.9.8 app/pb_kits/playbook/utilities/text.js