You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`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`
10
20
11
21
---
12
22
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
+
13
35
## 📦 Installation
14
36
15
37
```bash
@@ -18,6 +40,8 @@
18
40
19
41
## 🚀 Usage
20
42
43
+
You can use `string-utils-lite` in both **ES Modules** and **CommonJS** environments.
44
+
21
45
ES Modules
22
46
import { capitalize, titleCase, toKebabCase } from 'string-utils-lite';
23
47
@@ -33,20 +57,21 @@ CommonJS
33
57
34
58
## 📚 API Reference
35
59
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 |
0 commit comments