@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.
**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:
- Fork the repository.
- Create a feature branch:
git checkout -b feature/your-feature
- Commit your changes and push to the branch:
git commit -m "Add your message here" git push origin feature/your-feature
- 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
Links
- NPM Page: @taimoorsiddiq/cap-it
- GitHub Repository: GitHub
Author
👤 Taimoor Siddiq
For queries, feel free to email me or raise an issue on GitHub.