titleize-props

Capitalize every word in a string prop (excluding links) of a object.

Usage no npm install needed!

<script type="module">
  import titleizeProps from 'https://cdn.skypack.dev/titleize-props';
</script>

README

titleize-props

Last version Build Status Coverage Status Dependency status Dev Dependencies Status NPM Status Donate

Capitalize every word in a string prop (excluding links) of a object.

Install

$ npm install titleize-props --save

Usage

const titleizeProps = require('titleize-props')

const output = titleizeProps({
  title: 'TITLEIZE PROPS',
  stars: 1337,
  link: 'http://github.com/Kikobeats/titleize-props'
})

console.log(output)
// {
//  title: 'Titleize Props',
//  stars: 1337,
//  link: 'http://github.com/Kikobeats/titleize-props'
// }
//

API

titleizeProps(obj, [validator])

obj

Type: object

The object to be titleized.

validator(value)

Type: function

The method used for calculate each new key value.

The behavior of the default method:

  • Exclude non strings values.
  • Exclude urls.

License

MIT © Kiko Beats.