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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ez-string-toolkit

v1.0.2

Published

A simple and easy-to-use string utility library with essential string manipulation functions

Downloads

13

Readme

EZ String Toolkit

A simple and easy-to-use JavaScript string utility library with essential string manipulation functions.

Installation

npm install ez-string-toolkit

Usage

const stringUtils = require('ez-string-toolkit');

// Capitalize first letter
console.log(stringUtils.capitalize('hello')); // Output: "Hello"

// Convert to camelCase
console.log(stringUtils.toCamelCase('hello world')); // Output: "helloWorld"

// Reverse string
console.log(stringUtils.reverse('hello')); // Output: "olleh"

// Count words
console.log(stringUtils.wordCount('hello world')); // Output: 2

// Truncate string
console.log(stringUtils.truncate('hello world', 5)); // Output: "he..."

API Documentation

capitalize(str)

Capitalizes the first letter of a string.

  • Parameter: str (string) - The input string
  • Returns: (string) - String with first letter capitalized

Example:

capitalize('hello world'); // "Hello world"
capitalize('JAVASCRIPT'); // "Javascript"

toCamelCase(str)

Converts a string to camelCase format.

  • Parameter: str (string) - The input string
  • Returns: (string) - The camelCase formatted string

Example:

toCamelCase('hello world'); // "helloWorld"
toCamelCase('user-name-field'); // "userNameField"
toCamelCase('my_variable_name'); // "myVariableName"

reverse(str)

Reverses a string.

  • Parameter: str (string) - The input string
  • Returns: (string) - The reversed string

Example:

reverse('hello'); // "olleh"
reverse('JavaScript'); // "tpircSavaJ"

wordCount(str)

Counts the number of words in a string.

  • Parameter: str (string) - The input string
  • Returns: (number) - The number of words

Example:

wordCount('hello world'); // 2
wordCount('JavaScript is awesome!'); // 3
wordCount('  spaced   out   words  '); // 3

truncate(str, maxLength, suffix)

Truncates a string to a specified length.

  • Parameters:
    • str (string) - The input string
    • maxLength (number) - The maximum length
    • suffix (string, optional) - The suffix to add (default: '...')
  • Returns: (string) - The truncated string

Example:

truncate('This is a long sentence', 10); // "This is..."
truncate('Short text', 20); // "Short text"
truncate('Custom suffix', 10, ' →'); // "Custom →"

Features

  • Lightweight: Only 2.7 kB gzipped
  • Zero dependencies: No external dependencies
  • Well tested: Comprehensive test coverage
  • TypeScript friendly: Works great with TypeScript projects
  • Browser compatible: Works in both Node.js and browsers

Testing

Run the test suite:

npm test

Browser Usage

You can also use this library in the browser via CDN:

<script src="https://unpkg.com/ez-string-toolkit@latest/index.js"></script>
<script>
  // Library is available as global variable
  console.log(capitalize('hello world')); // "Hello world"
</script>

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request or open an Issue.

Changelog### v1.0.2- Added homepage URL: https://bgsiscript.com- Package metadata improvements### v1.0.1- Updated README with English documentation- Added more examples and improved documentation### v1.0.0- Initial release- Basic string utility functions: capitalize, toCamelCase, reverse, wordCount, truncate