@directus/format-title
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -51,6 +51,6 @@ const decamelize = require('decamelize'); | ||
* | ||
* const prettyName = formatName(safeName); | ||
* const prettyName = formatTitle(safeName); | ||
* // => 'Comment Metadata' | ||
*/ | ||
module.exports = function formatName(title, separator = /\s|-|_/g) { | ||
module.exports = function formatTitle(title, separator = /\s|-|_/g) { | ||
return decamelize(title) | ||
@@ -57,0 +57,0 @@ .split(separator) |
{ | ||
"name": "@directus/format-title", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Custom string formatter that converts any string into [Title Case](http://www.grammar-monster.com/lessons/capital_letters_title_case.htm)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,3 +11,6 @@ # format-title | ||
| `brighton_on_sea` | Brighton on Sea | | ||
| `apple_releases_new_ipad` | Apple Releases New iPad | | ||
> Bonus: the package also handles specially-cased words such as iPad, PDFs, or McDonalds | ||
## Installation | ||
@@ -28,4 +31,7 @@ ```bash | ||
You can provide an optional `separator` regex as a second parameter to support splitting the string on different characters. By default, this regex is set to `/\s|-|_/g`. | ||
You can provide an optional `separator` regex as a second parameter to support splitting the string on different characters. By default, this regex is set to `/\s|-|_/g`. | ||
## Contributing | ||
If your favorite specially cased word isn't being capitalized properly, [please open an issue](https://github.com/rijkvanzanten/special-case/issues/new) or submit a pull request on [the repo that contains those words](https://github.com/rijkvanzanten/special-case)! | ||
## License | ||
@@ -32,0 +38,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6158
40