function titleCase(str) {
  const lowers = [
    'a',
    'an',
    'and',
    'as',
    'at',
    'but',
    'by',
    'for',
    'for',
    'from',
    'in',
    'into',
    'near',
    'nor',
    'of',
    'on',
    'onto',
    'or',
    'the',
    'to',
    'with',
  ].map(lower => `\\s${lower}\\s`)
  const regex = new RegExp(`(?!${lowers.join('|')})\\w\\S*`, 'g')
  return `${str}`.replace(
    regex,
    txt => txt.charAt(0).toUpperCase() + txt.slice(1).replace(/[A-Z]/g, word => ` ${word}`),
  )
}
@param {string} str
@return {string} titleized string