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.1.0 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.0.3.pre.alpha.walkthrough2 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.0.3.pre.alpha.walkthrough app/pb_kits/playbook/utilities/text.js
playbook_ui-10.0.1.alpha.railscusticon app/pb_kits/playbook/utilities/text.js
playbook_ui-10.0.2.pre.alpha.pre.iconfix app/pb_kits/playbook/utilities/text.js
playbook_ui-10.0.1.alpha.rtflexfix app/pb_kits/playbook/utilities/text.js
playbook_ui-10.0.0.pre.alphafonts app/pb_kits/playbook/utilities/text.js
playbook_ui-10.0.1 app/pb_kits/playbook/utilities/text.js
playbook_ui-10.0.0 app/pb_kits/playbook/utilities/text.js
playbook_ui-9.19.0.pre.alpha.pre.fonts2 app/pb_kits/playbook/utilities/text.js
playbook_ui-9.19.0 app/pb_kits/playbook/utilities/text.js
playbook_ui-9.19.0.pre.alphafonts app/pb_kits/playbook/utilities/text.js
playbook_ui-9.18.0.flow.bin.alpha app/pb_kits/playbook/utilities/text.js
playbook_ui-9.18.0 app/pb_kits/playbook/utilities/text.js
playbook_ui-9.17.0 app/pb_kits/playbook/utilities/text.js
playbook_ui-9.17.0.pre.decouple.website2 app/pb_kits/playbook/utilities/text.js
playbook_ui-9.16.0 app/pb_kits/playbook/utilities/text.js
playbook_ui-9.15.0 app/pb_kits/playbook/utilities/text.js
playbook_ui-9.15.0.pre.decouple.website1 app/pb_kits/playbook/utilities/text.js
playbook_ui-9.14.1.alpha.radio.alignment app/pb_kits/playbook/utilities/text.js