npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

capitalize-utils

v1.0.1

Published

A comprehensive TypeScript library for text capitalization utilities supporting English, Ukrainian, and Russian languages

Readme

capitalize-utils

A comprehensive TypeScript library for text capitalization utilities supporting English, Ukrainian, and Russian languages.

Features

  • 🚀 Multilingual Support: Works with English, Ukrainian, and Russian text
  • 📦 Zero Dependencies: Lightweight and fast
  • 🔧 TypeScript: Full TypeScript support with type definitions
  • 🎯 Multiple Functions: 9 different capitalization utilities
  • 🛡️ Robust: Handles edge cases and invalid input gracefully

Installation

npm install capitalize-utils

Quick Start

import {
  capitalizeWord,
  capitalizeSentence,
  capitalizeEachWord,
} from "capitalize-utils";

// Basic usage
capitalizeWord("hello"); // 'Hello'
capitalizeSentence("hello world"); // 'Hello world'
capitalizeEachWord("hello world"); // 'Hello World'

API Reference

capitalizeWord(word: string): string

Capitalizes the first letter of a single word.

import { capitalizeWord } from "capitalize-utils";

capitalizeWord("hello"); // 'Hello'
capitalizeWord("WORLD"); // 'World'
capitalizeWord("привіт"); // 'Привіт'
capitalizeWord("мир"); // 'Мир'

capitalizeSentence(sentence: string): string

Capitalizes the first letter of the first word in a sentence.

import { capitalizeSentence } from "capitalize-utils";

capitalizeSentence("hello world"); // 'Hello world'
capitalizeSentence("привіт світ"); // 'Привіт світ'
capitalizeSentence("  hello world  "); // 'Hello world'

capitalizeEachWord(text: string): string

Capitalizes the first letter of each word in a string.

import { capitalizeEachWord } from "capitalize-utils";

capitalizeEachWord("hello world"); // 'Hello World'
capitalizeEachWord("привіт світ"); // 'Привіт Світ'
capitalizeEachWord("hello, world!"); // 'Hello, World!'

capitalizeSentences(text: string): string

Capitalizes the first letter of each sentence in a text.

import { capitalizeSentences } from "capitalize-utils";

capitalizeSentences("hello world. how are you?");
// 'Hello world. How are you?'

capitalizeSentences("привіт світ. як справи?");
// 'Привіт світ. Як справи?'

capitalizeWordsIgnoreSmall(text: string, smallWords?: string[]): string

Capitalizes words but ignores small words (articles, prepositions, etc.).

import { capitalizeWordsIgnoreSmall } from "capitalize-utils";

capitalizeWordsIgnoreSmall("the quick brown fox");
// 'The Quick Brown Fox'

capitalizeWordsIgnoreSmall("a tale of two cities");
// 'A Tale of Two Cities'

// Custom small words
capitalizeWordsIgnoreSmall("hello and world", ["and"]);
// 'Hello and World'

capitalizeFully(text: string): string

Capitalizes all letters in the text.

import { capitalizeFully } from "capitalize-utils";

capitalizeFully("hello world"); // 'HELLO WORLD'
capitalizeFully("привіт світ"); // 'ПРИВІТ СВІТ'

capitalizeCustom(text: string, options?: object): string

Custom capitalization with specific rules.

import { capitalizeCustom } from "capitalize-utils";

// Only capitalize first word
capitalizeCustom("hello world", { firstWordOnly: true });
// 'Hello world'

// Ignore specific words
capitalizeCustom("hello and world", { ignoreWords: ["and"] });
// 'Hello and World'

// Preserve case for ignored words
capitalizeCustom("Hello AND World", {
  ignoreWords: ["and"],
  preserveCase: true,
}); // 'Hello AND World'

uncapitalize(word: string): string

Converts the first letter of a word to lowercase.

import { uncapitalize } from "capitalize-utils";

uncapitalize("Hello"); // 'hello'
uncapitalize("WORLD"); // 'wORLD'
uncapitalize("Привіт"); // 'привіт'

uncapitalizeSentence(sentence: string): string

Converts the first letter of the first word in a sentence to lowercase.

import { uncapitalizeSentence } from "capitalize-utils";

uncapitalizeSentence("Hello world"); // 'hello world'
uncapitalizeSentence("Привіт світ"); // 'привіт світ'

Multilingual Examples

English

import { capitalizeEachWord } from "capitalize-utils";

capitalizeEachWord("hello world"); // 'Hello World'
capitalizeEachWord("the quick brown fox"); // 'The Quick Brown Fox'

Ukrainian

import { capitalizeEachWord } from "capitalize-utils";

capitalizeEachWord("привіт світ"); // 'Привіт Світ'
capitalizeEachWord("як справи?"); // 'Як Справи?'

Russian

import { capitalizeEachWord } from "capitalize-utils";

capitalizeEachWord("привет мир"); // 'Привет Мир'
capitalizeEachWord("как дела?"); // 'Как Дела?'

Default Import

You can also import all functions as a default object:

import capitalizeUtils from "capitalize-utils";

capitalizeUtils.capitalizeWord("hello"); // 'Hello'
capitalizeUtils.capitalizeEachWord("hello world"); // 'Hello World'

Development

Building

npm run build

Development Mode

npm run dev

Clean Build

npm run clean
npm run build

License

MIT

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Changelog

1.0.0

  • Initial release
  • Support for English, Ukrainian, and Russian languages
  • 9 capitalization utility functions
  • Full TypeScript support