|
| 1 | +# string-utils-lite |
| 2 | + |
| 3 | +[](https://www.npmjs.com/package/string-utils-lite) |
| 4 | +[](https://www.npmjs.com/package/string-utils-lite) |
| 5 | +[](https://github.com/yourname/string-utils-lite/actions) |
| 6 | +[](./LICENSE) |
| 7 | + |
| 8 | +> ✨ A tiny, dependency-free library for common string transformations: |
| 9 | +> `capitalize`, `titleCase`, `kebab-case`, `snake_case`, `camelCase`, `PascalCase`. |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +## 📦 Installation |
| 14 | + |
| 15 | + ```bash |
| 16 | + npm install string-utils-lite |
| 17 | + |
| 18 | + |
| 19 | +## 🚀 Usage |
| 20 | + |
| 21 | +ES Modules |
| 22 | + import { capitalize, titleCase, toKebabCase } from 'string-utils-lite'; |
| 23 | + |
| 24 | + console.log(capitalize('hELLo')); // "Hello" |
| 25 | + console.log(titleCase('hELLO woRLD')); // "Hello World" |
| 26 | + console.log(toKebabCase('Hello World')); // "hello-world" |
| 27 | + |
| 28 | +CommonJS |
| 29 | + const { capitalize, titleCase } = require('string-utils-lite'); |
| 30 | + |
| 31 | + console.log(capitalize('hELLo')); // "Hello" |
| 32 | + console.log(titleCase('foo bar')); // "Foo Bar" |
| 33 | + |
| 34 | +## 📚 API Reference |
| 35 | + |
| 36 | + Function Description Example Input Example Output |
| 37 | + capitalize(str) Uppercases the first letter, lowercases the rest "hELLo" "Hello" |
| 38 | + titleCase(str) Capitalises the first letter of each word "hELLO woRLD" "Hello World" |
| 39 | + toKebabCase(str) Converts string to kebab-case "Hello World" "hello-world" |
| 40 | + toSnakeCase(str) Converts string to snake_case "Hello World" "hello_world" |
| 41 | + toCamelCase(str) Converts string to camelCase "Hello World" "helloWorld" |
| 42 | + toPascalCase(str) Converts string to PascalCase "Hello World" "HelloWorld" |
| 43 | + |
| 44 | + All functions are pure and return new strings without mutating the input. |
| 45 | + |
| 46 | + |
| 47 | +## 🧪 Running Tests |
| 48 | + |
| 49 | + This project uses Vitest. |
| 50 | + |
| 51 | + npm test |
| 52 | + |
| 53 | +## 🛠 Development |
| 54 | + |
| 55 | + Clone the repo and install dependencies: |
| 56 | + |
| 57 | + git clone https://github.com/jahirultusar/JavaScript-string-utils-lite.git |
| 58 | + cd string-utils-lite |
| 59 | + npm install |
| 60 | + |
| 61 | + |
| 62 | + Build the package: |
| 63 | + |
| 64 | + npm run build |
| 65 | + |
| 66 | +## 🤝 Contributing |
| 67 | + |
| 68 | + Contributions are welcome! 🎉 |
| 69 | + |
| 70 | + Fork the repository |
| 71 | + |
| 72 | + Create a feature branch (git checkout -b feature/my-feature) |
| 73 | + |
| 74 | + Commit your changes (git commit -m 'feat: add new feature') |
| 75 | + |
| 76 | + Push to the branch (git push origin feature/my-feature) |
| 77 | + |
| 78 | + Open a Pull Request |
| 79 | + |
| 80 | + Please follow Conventional Commits for commit messages. |
| 81 | + |
| 82 | +📄 License |
| 83 | + |
| 84 | + MIT © 2025 Jahirul Tusar |
0 commit comments