Sha256: 99685888ddb0bc8ccffb70ceaac5b07242d57d7f7d55efc012abce3a28c7b8f6
Contents?: true
Size: 790 Bytes
Versions: 1
Compression:
Stored size: 790 Bytes
Contents
import { filter } from 'lodash' const isEmpty = (value: string | unknown): boolean => value === '' const titleizedWord = (word: string): string => ( word.charAt(0).toUpperCase() + word.slice(1).toLowerCase() ) export const titleize = (sentence: string): string => ( isEmpty(sentence) ? sentence : sentence.split(' ').map(titleizedWord).join(' ') ) const notEmpty = (value: string | Record<string, unknown>): boolean => !isEmpty(value) export const joinPresent = (array: string[], separator: string): string => ( filter(array, notEmpty).join(separator) ) export const camelToSnakeCase = (word: string): string => { return word.split(/([A-Z])/g).map((w, i) => { const prefix = i > 0 ? '_' : '' return w === w.toLowerCase() ? w : prefix + w.toLowerCase() }).join("") }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
playbook_ui-13.34.0.pre.alpha.PLAY14143357 | app/pb_kits/playbook/utilities/text.ts |