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

curslo-string-utilities

v2.1.3

Published

A simple utility library for string manipulation

Readme

Curslo String Utilities

A lightweight utility package for string manipulations in JavaScript and TypeScript.


🚀 Installation

Install via npm, yarn or pnpm:

npm install curslo-string-utilities

OR yarn

yarn add curslo-string-utilities

OR pnpm

pnpm add curslo-string-utilities

📖 Usage

Import the package in your JavaScript or TypeScript project:

const {
  capitalize,
  toCamelCase,
  toSnakeCase,
  toKebabCase,
  reverseString,
  truncateString,
  isPalindrome,
  removeWhitespace,
  countWords,
  toTitleCase,
  maskString,
  randomString,
} = require("curslo-string-utilities");

OR in TypeScript:

import {
  capitalize,
  toCamelCase,
  toSnakeCase,
  toKebabCase,
  reverseString,
  truncateString,
  isPalindrome,
  removeWhitespace,
  countWords,
  toTitleCase,
  maskString,
  randomString,
} from "curslo-string-utilities";

🔥 Functions & Examples

1️⃣ capitalize(word)

Converts the first letter of a word to uppercase.

console.log(capitalize("hello world")); // "Hello world"

2️⃣ toCamelCase(str)

Converts a string to camelCase.

console.log(toCamelCase("hello world")); // "helloWorld"

3️⃣ toSnakeCase(str)

Converts a string to snake_case.

console.log(toSnakeCase("hello world")); // "hello_world"

4️⃣ toKebabCase(str)

Converts a string to kebab-case.

console.log(toKebabCase("hello world")); // "hello-world"

5️⃣ reverseString(str)

Reverses the given string.

console.log(reverseString("hello")); // "olleh"

6️⃣ truncateString(str, length)

Truncates a string to a given length and adds "..." at the end.

console.log(truncateString("Hello World", 5)); // "Hello..."

7️⃣ isPalindrome(str)

Checks if a string is a palindrome.

console.log(isPalindrome("racecar")); // true
console.log(isPalindrome("hello")); // false

8️⃣ removeWhitespace(str)

Removes all whitespace from a string.

console.log(removeWhitespace("Hello World")); // "HelloWorld"

9️⃣ countWords(str)

Counts the number of words in a string.

console.log(countWords("This is a test")); // 4

🔟 toTitleCase(str)

Converts a string to title case.

console.log(toTitleCase("hello world")); // "Hello World"

1️⃣1️⃣ maskString(str, visibleChars = 4)

Masks all but the last visibleChars characters in a string.

console.log(maskString("1234567890")); // "**\*\***7890"
console.log(maskString("secretPassword", 3)); // "\***\*\*\*\*\*\*\***ord"

1️⃣2️⃣ randomString(length)

Generates a random alphanumeric string of the given length.

console.log(randomString(8)); // Example output: "A1B2C3D4"

✅ Testing

Run tests using Jest:

npm test

👨‍💻 Contributing

Contributions are welcome!

Fork the repository Make your changes Open a pull request


🔨 Development

If you want to contribute or modify this package:

  1. Clone the repository:
    git clone https://github.com/Curslo/curslo-string-utilities.git
    cd curslo-string-utilities
  2. Install dependencies:
    npm install
  3. Build the package:
    npm run build
  4. Run tests:
    npm test

🌟 Support

If you like this package, please ⭐ star the repository on GitHub!


📜 License

This project is licensed under the MIT License.


📢 Changelog

  • v2.1.3 (Latest)
    • Converted to TypeScript for better type safety.
    • Updated package exports for ES Module & CommonJS compatibility.
    • Added more string utilities
    • Can Build, run test with jest and its the most stable version
  • v2.1.0
    • Initial release with string utility functions.
    • Converted to TypeScript for better type safety.
    • Updated package exports for ES Module & CommonJS compatibility.