# title-case

> Transform a string into title case following English rules

Latest version **4.3.2** (published 2024-09-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install title-case
pnpm add title-case
yarn add title-case
bun add title-case
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.3.2 |
| Published | 2024-09-15 |
| First published | 2014-03-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2404 |
| Author | Blake Embrey |
| Maintainers | blakeembrey |
| Keywords | title, case, english, capital, sentence, convert, transform |

## Links

- npm: https://www.npmjs.com/package/title-case
- Repository: https://github.com/blakeembrey/change-case
- Homepage: https://github.com/blakeembrey/change-case/tree/master/packages/title-case#readme
- Issues: https://github.com/blakeembrey/change-case/issues
- npm.io page: https://npm.io/package/title-case

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 4.3.2 (latest) — 2024-09-15
- 4.3.1 — 2024-01-14
- 4.3.0 — 2024-01-08
- 4.2.0 — 2023-12-09
- 4.1.2 — 2023-10-20
- 4.1.1 — 2023-10-18
- 4.1.0 — 2023-10-03
- 4.0.1 — 2023-10-03
- 4.0.0 — 2023-09-30
- 3.0.3 — 2020-12-02
- 3.0.2 — 2019-12-06
- 3.0.1 — 2019-12-03
- 3.0.0 — 2019-12-01
- 2.1.1 — 2017-03-18
- 2.1.0 — 2016-06-12
- … 9 more at https://npm.io/package/title-case/versions

## README

# Title Case

> Transform a string into [title case](https://en.wikipedia.org/wiki/Letter_case#Title_case) following English rules.

## Installation

```
npm install title-case --save
```

## Usage

```js
import { titleCase } from "title-case";

titleCase("string"); //=> "String"
titleCase("follow step-by-step instructions"); //=> "Follow Step-by-Step Instructions"
```

### Options

- `locale?: string | string[]` Locale used for `toLocaleUpperCase` during case transformation (default: `undefined`)
- `sentenceCase?: boolean` Only capitalize the first word of each sentence (default: `false`)
- `sentenceTerminators?: Set<string>` Set of characters to consider a new sentence under sentence case behavior (e.g. `.`, default: `SENTENCE_TERMINATORS`)
- `smallWords?: Set<string>` Set of words to keep lower-case when `sentenceCase === false` (default: `SMALL_WORDS`)
- `titleTerminators?: Set<string>` Set of characters to consider a new sentence under title case behavior (e.g. `:`, default: `TITLE_TERMINATORS`)
- `wordSeparators?: Set<string>` Set of characters to consider a new word for capitalization, such as hyphenation (default: `WORD_SEPARATORS`)

## TypeScript and ESM

This package is a [pure ESM package](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) and ships with TypeScript definitions. It cannot be `require`'d or used with CommonJS module resolution in TypeScript.

## License

MIT

---
_Source: https://npm.io/package/title-case · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
