
Research
/Security News
npm Author Qix Compromised via Phishing Email in Major Supply Chain Attack
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
apa-title-case
Advanced tools
Converts a string to title case in APA or Chicago style
Converts a string to title case APA (default) or Chicago style
apa-title-case
is a Node.js package that converts a string to APA or Chicago-style title case. APA follows the first letter of each major word capitalized while Chicago capitalizes every word except for short conjunctions and prepositions.
You can install title-case
using npm:
npm install apa-title-case
Alternatively, you can also install it using yarn:
yarn add apa-title-case
After installing the package, you can use it in your code by importing it:
const toTitleCase = require('apa-title-case');
Or if you're using ES6 syntax:
import { toTitleCase } from 'apa-title-case';
String.prototype.toTitleCase(style, options);
shortConjunctions
: short conjunctions that should not be capitalized, such as "and", "but", and "if"articles
: articles that should not be capitalized, such as "a", "an", and "the".shortPrepositions
: short prepositions that should not be capitalized, such as "of", "to", and "by".neverCapitalized
: words that should never be capitalized, such as "etc.", "i.e.", and "vs.".A new string with the original string converted to title case.
// Example 1: Default title case
const input = "the quick brown fox jumps over the lazy dog";
const output = input.toTitleCase(); // "The Quick Brown Fox Jumps Over the Lazy Dog"
// Example 2: Title case with small words not capitalized
const input = "to be or not to be";
const output = input.toTitleCase(); // "To Be or Not to Be"
// Example 3: Title case with specific words not capitalized
const input = "the name of the musical is The Musical";
const output = input.toTitleCase( { neverCapitalized: ["The Musical"] }); // "The Name of the Musical Is The Musical"
// Example 4: Chicago style title case
const input = "the quick rabbit together with the brown fox jumped over the dog";
const output = input.toTitleCase({ style: "chicago" }); // "The Quick Rabbit Together with the Brown Fox Jumped Over the Dog"
npm test
String.prototype.toTitleCase
✓ throws TypeError if input is not a string (3 ms)
✓ throws TypeError if options is not an object (3 ms)
✓ capitalizes the first letter of each word in a sentence
✓ capitalizes the first letter of the first word in a sentence (2 ms)
✓ handles hyphenated words and last words in a sentence
✓ capitalizes the first word of a sentence
✓ capitalizes all significant words in a sentence
✓ excludes specific words from capitalization
✓ capitalizes significant words with Chicago style
✓ does not modify already capitalized words (1 ms)
✓ returns an empty string for empty input
Test Suites: 1 passed, 1 total
Tests: 11 passed, 11 total
Snapshots: 0 total
Time: 0.134 s, estimated 1 s
FAQs
Converts a string to title case in APA or Chicago style
The npm package apa-title-case receives a total of 0 weekly downloads. As such, apa-title-case popularity was classified as not popular.
We found that apa-title-case demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.