Sha256: 8340d281243a1690009c5e43be50ea698f2cb966c6dd55495932805a133a37b1

Contents?: true

Size: 411 Bytes

Versions: 351

Compression:

Stored size: 411 Bytes

Contents

import { filter, isEmpty } from 'lodash'

const titleizedWord = (string) => (
  string.charAt(0).toUpperCase() + string.slice(1).toLowerCase()
)

export const titleize = (sentence) => (
  isEmpty(sentence) ? sentence : sentence.split(' ').map(titleizedWord).join(' ')
)

const notEmpty = (value) => !isEmpty(value)

export const joinPresent = (array, separator) => (
  filter(array, notEmpty).join(separator)
)

Version data entries

351 entries across 351 versions & 1 rubygems

Version Path
playbook_ui-10.26.0.pre.rc1 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.26.0.pre.alpha.sticky1 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.26.0.pre.alpha.display1 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.26.0.pre.alpha3 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.25.1 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.25.0 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.25.0.pre.alpha3 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.25.0.pre.treeshaking1 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.24.0 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.24.0.pre.alpha1 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.23.0 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.23.0.pre.alpha2 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.23.0.pre.cachetest app/pb_kits/playbook/utilities/text.js
playbook_ui-10.23.0.pre.alpha1 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.22.1 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.22.0 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.21.1.pre.alpha1 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.21.0.pre.alpha.lightbox.2 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.21.0 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.21.0.pre.alpha.lightbox app/pb_kits/playbook/utilities/text.js