@directus/format-title
Advanced tools
Comparing version 9.0.0-rc.62 to 9.0.0-rc.63
{ | ||
"name": "@directus/format-title", | ||
"version": "9.0.0-rc.62", | ||
"version": "9.0.0-rc.63", | ||
"description": "Custom string formatter that converts any string into [Title Case](http://www.grammar-monster.com/lessons/capital_letters_title_case.htm)", | ||
@@ -40,3 +40,3 @@ "keywords": [ | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.33.1", | ||
"rollup": "^2.46.0", | ||
"rollup-plugin-sourcemaps": "^0.6.3", | ||
@@ -47,3 +47,3 @@ "rollup-plugin-terser": "^7.0.2", | ||
}, | ||
"gitHead": "c653b167298289ff3540ba66b7516350a96f7ac5" | ||
"gitHead": "5df6696bc029902b57eb5eb118c6fc39960937ef" | ||
} |
## Title Formatter | ||
Custom string formatter that converts any string into [Title Case](http://www.grammar-monster.com/lessons/capital_letters_title_case.htm) | ||
Custom string formatter that converts any string into | ||
[Title Case](http://www.grammar-monster.com/lessons/capital_letters_title_case.htm) | ||
This package converts any string into title case. This means only using capital letters for the principal words. Articles, conjunctions, and prepositions do not get capital letters unless they start or end the title | ||
This package converts any string into title case. This means only using capital letters for the principal words. | ||
Articles, conjunctions, and prepositions do not get capital letters unless they start or end the title | ||
| input | output | | ||
|------------------------------|---------------------------------| | ||
| ---------------------------- | ------------------------------- | | ||
| `snowWhiteAndTheSevenDwarfs` | Snow White and the Seven Dwarfs | | ||
@@ -15,5 +17,7 @@ | `NewcastleUponTyne` | Newcastle upon Tyne | | ||
> The package contains a list of words that use some sort of special casing, for example: McDonalds, iPhone, and YouTube. | ||
> The package contains a list of words that use some sort of special casing, for example: McDonalds, iPhone, and | ||
> YouTube. | ||
## Installation | ||
```bash | ||
@@ -24,4 +28,6 @@ $ npm install @directus/format-title | ||
## Usage | ||
The package by default converts camelCase, PascalCase, underscore, and "regular" scentences to [Title Case](http://www.grammar-monster.com/lessons/capital_letters_title_case.htm) | ||
The package by default converts camelCase, PascalCase, underscore, and "regular" scentences to | ||
[Title Case](http://www.grammar-monster.com/lessons/capital_letters_title_case.htm) | ||
```js | ||
@@ -34,5 +40,8 @@ formatTitle(string, [separator]); | ||
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/directus/format-title/issues/new) or submit a pull request! | ||
If your favorite specially cased word isn't being capitalized properly, | ||
[please open an issue](https://github.com/directus/format-title/issues/new) or submit a pull request! |
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
43980
45