npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

string-utils-lite

v0.1.10

Published

Tiny string helpers: capitalize, titleCase, kebab-case, snake_case, camelCase, and PascalCase.

Downloads

7

Readme

string-utils-lite

npm version npm downloads CI Release license

🎮 Live Playground

Try the library instantly in your browser:
👉 Playground Demo

What is string-utils-lite?

string-utils-lite is a tiny, dependency-free JavaScript library that makes common string transformations effortless and consistent across projects.

It provides simple helper functions for everyday string formatting needs:

  • capitalize → Uppercases the first character, lowercases the rest
  • titleCase → Capitalises the first character of every word
  • toKebabCase → Converts text into kebab-case
  • toSnakeCase → Converts text into snake_case
  • toCamelCase → Converts text into camelCase
  • toPascalCase → Converts text into PascalCase

💡 Why use this library?

JavaScript lacks built-in utilities for string case transformations (unlike Python’s .title() or .capitalize()).
While you could write ad-hoc functions, string-utils-lite saves time by offering:

  • Consistency — same results across all projects
  • Zero dependencies — lightweight, no bloat
  • Dual support — works with both ESM and CommonJS
  • Tree-shakable — import only what you need

Whether you’re cleaning up user input, formatting identifiers, or ensuring consistency in APIs, this library provides a clear and minimal solution.

📦 Installation

Using npm (recommended):

```bash
npm install string-utils-lite

🚀 Usage

You can use string-utils-lite in multiple environments:

ES Modules:

import { capitalize, titleCase, toKebabCase } from 'string-utils-lite';

console.log(capitalize('hELLo'));        // "Hello"
console.log(titleCase('hELLO   woRLD')); // "Hello   World"
console.log(toKebabCase('Hello World')); // "hello-world"

CommonJS:

const { capitalize, titleCase } = require('string-utils-lite');

console.log(capitalize('hELLo')); // "Hello"
console.log(titleCase('foo bar')); // "Foo Bar"

CDN (Direct Browser Use):

No installation required! Load from a CDN like esm.sh and use in the browser. For example:

<script type="module">
    import { capitalize, titleCase } from "https://esm.sh/string-utils-lite";

    console.log(capitalize("hELLo"));        // "Hello"
    console.log(titleCase("hELLO woRLD"));   // "Hello World");
</script>

📚 API Reference

| Function          | Description                                      | Example Input   | Example Output  |
|-------------------|--------------------------------------------------|-----------------|-----------------|
| `capitalize(str)` | Uppercases the first letter, lowercases the rest | `"hELLo"`       | `"Hello"`       |
| `titleCase(str)`  | Capitalises the first letter of each word        | `"hELLO woRLD"` | `"Hello World"` |
| `toKebabCase(str)`| Converts string to kebab-case                    | `"Hello World"` | `"hello-world"` |
| `toSnakeCase(str)`| Converts string to snake_case                    | `"Hello World"` | `"hello_world"` |
| `toCamelCase(str)`| Converts string to camelCase                     | `"Hello World"` | `"helloWorld"`  |
| `toPascalCase(str)`| Converts string to PascalCase                   | `"Hello World"` | `"HelloWorld"`  |

ℹ️ All functions are pure: they return a new string without mutating the input.

🧪 Running Tests

This project uses Vitest

npm test

🛠 Development

Clone the repo and install dependencies:

git clone https://github.com/jahirultusar/JavaScript-string-utils-lite.git
cd string-utils-lite
npm install


Build the package:

npm run build

🤝 Contributing

Contributions are welcome! 🎉

Fork the repository

Create a feature branch (git checkout -b feature/my-feature)

Commit your changes (git commit -m 'feat: add new feature')

Push to the branch (git push origin feature/my-feature)

Open a Pull Request

Please follow Conventional Commits for commit messages.

📄 License

MIT © 2025 Jahirul Tusar