@investorphem/string-tools
v1.0.4
Published
Handy string utility functions for developers.
Maintainers
Readme
@investorphem/string-tools
🚀 Description
@investorphem/string-tools is a robust, lightweight, and production-ready JavaScript utility library for handling common string operations.
It is designed for developers who want simple, fast, and dependency-free utilities built for modern JavaScript environments with automated CI/CD publishing via GitHub Actions.
✨ Features
- 🔠 Capitalize the first letter of any string
- 🔗 Convert strings to kebab-case
- 🔄 Reverse strings efficiently
- 🛡️ Null-Safe: Safely handles empty or undefined inputs without crashing
- ⚡ Modern ESM: Native ES Module support (
import/export) - 🍃 Zero dependencies (ultra-lightweight)
- 🤖 Fully automated npm publishing with GitHub Actions
- 📦 Scoped package for better organization (
@investorphem/*)
📦 Installation
npm install @investorphem/string-toolsor via yarn:
yarn add @investorphem/string-tools🧠 Usage (ES Modules)
Since version 1.0.3, this package uses standard ES Modules.
import { capitalize, kebabCase, reverse } from '@investorphem/string-tools';
console.log(capitalize('hello')); // "Hello"
console.log(kebabCase('Hello World')); // "hello-world"
console.log(reverse('abc')); // "cba"
// Safely handles empty values
console.log(capitalize('')); // ""📚 API Reference
capitalize(str)
Capitalizes the first character of a string.
Parameters:
str(string) – The string to capitalize
Returns:
- (string) – Capitalized string (returns empty string if input is falsy)
kebabCase(str)
Converts a string to kebab-case. Handles spaces and camelCase transitions.
Parameters:
str(string) – The string to convert
Returns:
- (string) – Kebab-case string (returns empty string if input is falsy)
reverse(str)
Reverses the input string.
Parameters:
str(string) – The string to reverse
Returns:
- (string) – Reversed string (returns empty string if input is falsy)
⚙️ CI/CD (GitHub Actions)
This project is fully automated using GitHub Actions:
- On every push to
main:- Version is automatically bumped (patch)
- Package is published to npm
⚠️ Important Note
If publishing fails with:
403 Forbidden - You cannot publish over the previously published versionsIt means:
- npm does NOT allow publishing the same version twice.
- Ensure the version is properly incremented before publishing.
🛠️ Contributing
Contributions are welcome!
- Fork the repository
- Create a new branch
- Make your changes
- Submit a pull request
Make sure your code follows the StandardJS style guide.
📄 License
This project is licensed under the MIT License.
🏷️ Badges Explained
- npm version → Latest published version
- npm downloads → Monthly downloads count
- License → Project license
- Build Status → GitHub Actions workflow status
- Code Style → StandardJS compliance
- Contributors → Number of contributors
👨💻 Author
Oluwafemi Olagoke
🔥 Pro Tip
Always ensure your version changes before publishing. GitHub Actions handles this automatically, but if you manually publish, run:
npm version patchbefore:
npm publish --access public⭐ If you find this package useful, consider giving the repo a star!
