Skip to content

Releases: bhar2254/string-utils

Initial Release: string-utils v1.0.1 🚀

21 Nov 14:58
592e93b

Choose a tag to compare

The first release of string-utils, a lightweight and versatile library for enhancing JavaScript's String.prototype with powerful and easy-to-use methods for string manipulation.

Features

Case Transformation

  • toCamelCase: Converts strings to camelCase.
  • toSnakeCase: Converts strings to snake_case.
  • toKebabCase: Converts strings to kebab-case.

Truncation

  • truncate: Truncates a string to a specified length and appends ....

Validation

  • isPalindrome: Checks if a string is a palindrome.
  • containsOnlyLetters: Verifies if a string contains only alphabetic characters.

Formatting

  • pad: Pads a string to the specified length with a character.
  • reverse: Reverses the string.

Word Manipulation

  • wordCount: Counts the number of words in a string.
  • capitalize / capitalizeFirst: Capitalizes the first letter of a string.
  • capitalizeWords: Capitalizes the first letter of each word.

Customizations

  • removeVowels: Removes all vowels from a string.
  • replaceSpacesWith: Replaces spaces with a specified character.
  • replaceUnderscoreWith: Replaces underscores with a specified character.
  • stripHtml: Removes all HTML tags from a string.

Installation

Install the package using NPM:

npm install @bhar2254/string-utils

Usage

Load the extended String.prototype methods:

const { loadStringPrototypes } = require('@bhar2254/string-utils');

loadStringPrototypes();

console.log("hello_world".toCamelCase()); // "helloWorld"
console.log("racecar".isPalindrome()); // true

Start transforming your strings with ease! 💻✨
Feedback and contributions are welcome. Let’s make string manipulation in JavaScript effortless.