Gathering detailed insights and metrics for @gouch/to-title-case
Gathering detailed insights and metrics for @gouch/to-title-case
Gathering detailed insights and metrics for @gouch/to-title-case
Gathering detailed insights and metrics for @gouch/to-title-case
npm install @gouch/to-title-case
92.2
Supply Chain
96
Quality
74.9
Maintenance
100
Vulnerability
100
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
365 Stars
46 Commits
72 Forks
19 Watching
1 Branches
3 Contributors
Updated on 07 Oct 2024
JavaScript (78.46%)
HTML (21.54%)
Cumulative downloads
Total Downloads
Last day
2.4%
2,261
Compared to previous day
Last week
3%
13,254
Compared to previous week
Last month
2.5%
53,114
Compared to previous month
Last year
23.8%
624,301
Compared to previous year
Intelligently format your headlines into title case.
<script src="to-title-case.js"></script>
npm install @gouch/to-title-case
and then add require('@gouch/to-title-case')
to your scriptUse the .toTitleCase()
method on strings you want converted to title case:
1'Make me a headline'.toTitleCase() // returns: Make Me a Headline
The script assumes input is either sentence case (e.g. To title case for JavaScript) or every-word “title case” (e.g. To Title Case For JavaScript). In both cases, the script will convert the text to To Title Case for JavaScript.
Title case (or headline case) is a convention for formatting the titles of things. It’s often used for the title of articles, but also matters if you mention the title of something in paragraph.
These rules are based on style guides from APA, Chicago, and modern conventions. The result will match general expectations for what a title should look like. Some style guides might state special rules depending on contextual use, but these decisions rely on grammatical understanding, which is beyond the scope of a small script. Your titles will at least be consistent.
* Treating these as small words was inherited from Gruber's implementation. They're likely based on New York Times style. Opinions are welcome on whether these should be removed in a future version.
If you’re stuck with uppercase input, you can get to title case by changing to lowercase first:
1'CAPSLOCK FOREVER'.toLowerCase().toTitleCase() // returns: Capslock Forever
2
3// Don’t actually do this until you read the notes below!
Think hard before doing this! As frustrating as all uppercase input can be, acronyms are very common. Turning genuine abbreviations into blatant typos is a worse look than all caps. As an example, this was a real headline from CNN:
PETA: Turkey, TX, change your name
If you brute forced that into title case, you'd wind up with Peta and Tx, which would make Cnn look pretty amateur.
split
instead of replace
. This makes it easier to follow what the script is doing.I built this after reading John Gruber’s explanation of title case.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 2/28 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
39 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More