Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@taimoorsiddiq/cap-it

cap-it is a lightweight and user-friendly utility for string capitalization. It allows developers to effortlessly capitalize first letter of any string, ensuring clean and professional formatting in their applications.

string capitalization, capitalize string, capitalize first letter, string formatter, string manipulation, text formatter, string utilities, text transformation, capitalize utility, capitalize words, JavaScript string utilities, text tools, lightweight utility, capitalize library, string helper

readme

@taimoorsiddiq/cap-it

A lightweight utility for string capitalization.
Effortlessly capitalize the first letter of any string, ensuring clean, professional formatting in your JavaScript applications.

npm version
License: MIT
Downloads


**Why Use @taimoorsiddiq/cap-it?

  • 🟢 Simple and Lightweight: A small, focused utility with no dependencies.
  • 🟢 Effortless Integration: Easy to use in any JavaScript or Node.js application.
  • 🟢 Improved Readability: Ensures proper formatting for strings in your app.
  • 🟢 Versatile Applications: Perfect for text transformation in web, server-side, or CLI applications.

Installation

To use @taimoorsiddiq/cap-it in your project, install it via npm:

npm install @taimoorsiddiq/cap-it

Usage

Using @taimoorsiddiq/cap-it is straightforward. Here's how:

// Import the package
const capitalize = require("@taimoorsiddiq/cap-it");

// Example 1: Capitalize a single string
console.log(capitalize("hello world")); // Output: "Hello world"

// Example 2: Handle empty or invalid inputs
console.log(capitalize(""));            // Output: ""
console.log(capitalize(null));          // Output: ""

API

The package provides a single function:

capitalize(inputString)

  • Parameters:

    • inputString (string): The string to be capitalized.
  • Returns:

    • (string): The input string with the first letter capitalized. Returns an empty string if the input is invalid.

Features

  • Capitalizes the first letter of any string.
  • Handles edge cases like empty or non-string inputs gracefully.
  • Lightweight and dependency-free.

Use Cases

  • 📝 Capitalizing user input for cleaner display.
  • 🛠️ Transforming text for headings or labels.
  • 🌐 Formatting strings for web or server-side applications.

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a feature branch:
    git checkout -b feature/your-feature
  3. Commit your changes and push to the branch:
    git commit -m "Add your message here"
    git push origin feature/your-feature
  4. Submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Keywords

  • string capitalization
  • capitalize string
  • capitalize first letter
  • string utilities
  • text transformation
  • JavaScript text tools
  • string formatting utility
  • lightweight utility
  • capitalize library


Author

👤 Taimoor Siddiq
For queries, feel free to email me or raise an issue on GitHub.