Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 058a36b

Browse files
docs: improve usage and API fetures
1 parent 3096e40 commit 058a36b

File tree

1 file changed

+36
-11
lines changed

1 file changed

+36
-11
lines changed

‎README.md‎

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,33 @@
55
[![CI](https://github.com/yourname/string-utils-lite/actions/workflows/ci.yml/badge.svg)](https://github.com/jahirultusar/JavaScript-string-utils-lite/actions)
66
[![license](https://img.shields.io/github/license/jahirultusar/string-utils-lite)](./LICENSE)
77

8-
> ✨ A tiny, dependency-free JavaScript library for common string transformations:
9-
> `capitalize`, `titleCase`, `kebab-case`, `snake_case`, `camelCase`, `PascalCase`.
8+
## ✨ What is `string-utils-lite`?
9+
10+
`string-utils-lite` is a **tiny, dependency-free JavaScript library** that makes common string transformations effortless and consistent across projects.
11+
12+
It provides simple helper functions for everyday string formatting needs:
13+
14+
- `capitalize` → Uppercases the first character, lowercases the rest
15+
- `titleCase` → Capitalises the first character of every word
16+
- `toKebabCase` → Converts text into `kebab-case`
17+
- `toSnakeCase` → Converts text into `snake_case`
18+
- `toCamelCase` → Converts text into `camelCase`
19+
- `toPascalCase` → Converts text into `PascalCase`
1020

1121
---
1222

23+
## 💡 Why use this library?
24+
25+
JavaScript lacks built-in utilities for string case transformations (unlike Python’s `.title()` or `.capitalize()`).
26+
While you could write ad-hoc functions, `string-utils-lite` saves time by offering:
27+
28+
-**Consistency** — same results across all projects
29+
-**Zero dependencies** — lightweight, no bloat
30+
-**Dual support** — works with both **ESM** and **CommonJS**
31+
-**Tree-shakable** — import only what you need
32+
33+
Whether you’re cleaning up user input, formatting identifiers, or ensuring consistency in APIs, this library provides a clear and minimal solution.
34+
1335
## 📦 Installation
1436

1537
```bash
@@ -18,6 +40,8 @@
1840

1941
## 🚀 Usage
2042

43+
You can use `string-utils-lite` in both **ES Modules** and **CommonJS** environments.
44+
2145
ES Modules
2246
import { capitalize, titleCase, toKebabCase } from 'string-utils-lite';
2347

@@ -33,20 +57,21 @@ CommonJS
3357

3458
## 📚 API Reference
3559

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"
60+
| Function | Description | Example Input | Example Output |
61+
|-------------------|--------------------------------------------------|-----------------|-----------------|
62+
| `capitalize(str)` | Uppercases the first letter, lowercases the rest | `"hELLo"` | `"Hello"` |
63+
| `titleCase(str)` | Capitalises the first letter of each word | `"hELLO woRLD"` | `"Hello World"` |
64+
| `toKebabCase(str)`| Converts string to kebab-case | `"Hello World"` | `"hello-world"` |
65+
| `toSnakeCase(str)`| Converts string to snake_case | `"Hello World"` | `"hello_world"` |
66+
| `toCamelCase(str)`| Converts string to camelCase | `"Hello World"` | `"helloWorld"` |
67+
| `toPascalCase(str)`| Converts string to PascalCase | `"Hello World"` | `"HelloWorld"` |
4368

44-
All functions are pure and return new strings without mutating the input.
69+
> i️ All functions are **pure**: they return a new string without mutating the input.
4570
4671

4772
## 🧪 Running Tests
4873

49-
This project uses Vitest.
74+
This project uses Vitest
5075

5176
npm test
5277

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /