Socket
Socket
Sign inDemoInstall

titleize

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    titleize

Capitalize every word in a string: `unicorn cake` → `Unicorn Cake`


Version published
Weekly downloads
2.4M
decreased by-25.12%
Maintainers
1
Install size
2.76 kB
Created
Weekly downloads
 

Package description

What is titleize?

The titleize npm package is a utility for converting strings to title case, where the first letter of each word is capitalized. It is useful for formatting titles or headings in text content.

What are titleize's main functionalities?

Title casing a single string

This feature allows you to convert a single string to title case. It capitalizes the first letter of each word while keeping the rest of the letters in lowercase.

const titleize = require('titleize');
console.log(titleize('mr. jones is from new york.')); // 'Mr. Jones Is From New York.'

Title casing an array of strings

This feature allows you to map over an array of strings and convert each one to title case.

const titleize = require('titleize');
const titles = ['mr. jones', 'dr. smith'];
const titleCased = titles.map(title => titleize(title));
console.log(titleCased); // ['Mr. Jones', 'Dr. Smith']

Ignoring certain words from being capitalized

This feature allows you to specify an array of words to ignore during the title casing process, so they remain in lowercase.

const titleize = require('titleize');
titleize('the wind in the willows', { ignore: ['the', 'in'] }); // 'The Wind in the Willows'

Other packages similar to titleize

Readme

Source

titleize

Capitalize every word in a string: unicorn cakeUnicorn Cake

Install

npm install titleize

Usage

import titleize from 'titleize';

titleize('foo bar');
//=> 'Foo Bar'

titleize('foo-bar');
//=> 'Foo-Bar'
  • camelcase - Convert a dash/dot/underscore/space separated string to camelcase

Keywords

FAQs

Last updated on 31 Aug 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc