Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@directus/format-title
Advanced tools
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
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 the title
input | output |
---|---|
snowWhiteAndTheSevenDwarfs | Snow White and the Seven Dwarfs |
NewcastleUponTyne | Newcastle upon Tyne |
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
$ npm install @directus/format-title
The package by default converts camelCase, PascalCase, underscore, and "regular" scentences to Title Case
formatTitle(string, [separator]);
formatTitle('snowWhiteAndTheSevenDwarfs');
// => Snow White and the Seven Dwarfs
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
.
If your favorite specially cased word isn't being capitalized properly, please open an issue or submit a pull request on the repo that contains those words!
MIT License
Copyright (c) 2018 RANGER Studio
FAQs
Custom formatter that converts any string into Title Case
The npm package @directus/format-title receives a total of 3,930 weekly downloads. As such, @directus/format-title popularity was classified as popular.
We found that @directus/format-title demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.