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 🙏

© 2024 – Pkg Stats / Ryan Hefner

textmanipulator

v1.0.2

Published

TextManipulator is a versatile JavaScript package designed to handle various text formatting needs. Whether you're working with names, sentences, or any other text data, TextManipulator provides a suite of functions to help you clean, format, and transfor

Downloads

6

Readme

TextManipulator

TextManipulator is a versatile JavaScript package designed to handle various text formatting needs. Whether you're working with names, sentences, or any other text data, TextManipulator provides a suite of functions to help you clean, format, and transform your strings with ease.

Features

  • Name Formatting: Capitalize names, join first and last names, remove underscores, and more.
  • String Cleaning: Remove unwanted characters, trim whitespace, and standardize text.
  • Case Conversion: Convert text to uppercase, lowercase, title case, etc.
  • Text Transformation: Apply custom transformations to your text data.

Installation

You can install TextManipulator via npm:

npm install textmanipulator

Usage

Here is an example of how to use TextManipulator in your JavaScript project:

const TextManipulator = require("textmanipulator");

// Example usage
const name = TextManipulator.formatName("john_doe");
const cleanedText = TextManipulator.cleanString("  Hello, World!  ");
const titleCaseText = TextManipulator.toTitleCase("hello world");
const snakeCaseText = TextManipulator.toSnakeCase("Hello World");
const camelCaseText = TextManipulator.toCamelCase("hello world");
const reversedText = TextManipulator.reverseString("Hello World");
const isPalindromeText = TextManipulator.isPalindrome(
  "A man a plan a canal Panama"
);
const kebabCaseText = TextManipulator.toKebabCase("Hello World");
const upperCaseText = TextManipulator.toUpperCase("hello world");
const lowerCaseText = TextManipulator.toLowerCase("HELLO WORLD");
const capitalizeFirstText = TextManipulator.capitalizeFirst("hello world");
const removeVowelsText = TextManipulator.removeVowels("Hello World");
const removeConsonantsText = TextManipulator.removeConsonants("Hello World");
const repeatedText = TextManipulator.repeatString("Hello", 3);
const truncatedText = TextManipulator.truncateString("Hello World", 5);
const paddedText = TextManipulator.padString("Hello", " ", 10);
const containsSubstringText = TextManipulator.containsSubstring(
  "Hello World",
  "World"
);
const replacedAllText = TextManipulator.replaceAll("Hello World", "o", "a");
const splitByCommaText = TextManipulator.splitByComma("Hello,World,JavaScript");
const removeNumbersText = TextManipulator.removeNumbers("Hello123");
const extractNumbersText = TextManipulator.extractNumbers("Hello123 World456");
const removePunctuationText =
  TextManipulator.removePunctuation("Hello, World!");
const isUpperCaseText = TextManipulator.isUpperCase("HELLO WORLD");
const isLowerCaseText = TextManipulator.isLowerCase("hello world");
const countWordsText = TextManipulator.countWords("Hello World");
const countCharactersText = TextManipulator.countCharacters("Hello World");
const countVowelsText = TextManipulator.countVowels("Hello World");
const countConsonantsText = TextManipulator.countConsonants("Hello World");
const countDigitsText = TextManipulator.countDigits("Hello123");
const startsWithText = TextManipulator.startsWith("Hello World", "Hello");
const endsWithText = TextManipulator.endsWith("Hello World", "World");
const repeatEachCharacterText = TextManipulator.repeatEachCharacter("Hello", 2);
const removeDuplicateCharactersText =
  TextManipulator.removeDuplicateCharacters("Hello World");
const removeWhitespaceText = TextManipulator.removeWhitespace("Hello World");
const insertStringText = TextManipulator.insertString(
  "Hello World",
  "Beautiful ",
  6
);
const pascalCaseText = TextManipulator.toPascalCase("hello world");
const dotCaseText = TextManipulator.toDotCase("Hello World");
const toggleCaseText = TextManipulator.toggleCase("Hello World");
const swapCaseText = TextManipulator.swapCase("Hello World");
const shuffledStringText = TextManipulator.shuffleString("Hello World");
const sortedCharactersText = TextManipulator.sortCharacters("Hello World");
const isAnagramText = TextManipulator.isAnagram("listen", "silent");
const containsOnlyLettersText = TextManipulator.containsOnlyLetters("Hello");
const containsOnlyNumbersText = TextManipulator.containsOnlyNumbers("12345");
const containsOnlyAlphanumericText =
  TextManipulator.containsOnlyAlphanumeric("Hello123");
const convertTabsToSpacesText = TextManipulator.convertTabsToSpaces(
  "\tHello\tWorld",
  4
);
const convertSpacesToTabsText = TextManipulator.convertSpacesToTabs(
  "    Hello    World",
  4
);
const escapeHTMLText = TextManipulator.escapeHTML("<div>Hello World</div>");
const unescapeHTMLText = TextManipulator.unescapeHTML(
  "&lt;div&gt;Hello World&lt;/div&gt;"
);
const stripHTMLTagsText = TextManipulator.stripHTMLTags(
  "<div>Hello World</div>"
);

console.log(name); // Output: John Doe
console.log(cleanedText); // Output: Hello, World!
console.log(titleCaseText); // Output: Hello World
console.log(snakeCaseText); // Output: hello_world
console.log(camelCaseText); // Output: helloWorld
console.log(reversedText); // Output: dlroW olleH
console.log(isPalindromeText); // Output: true
console.log(kebabCaseText); // Output: hello-world
console.log(upperCaseText); // Output: HELLO WORLD
console.log(lowerCaseText); // Output: hello world
console.log(capitalizeFirstText); // Output: Hello world
console.log(removeVowelsText); // Output: Hll Wrld
console.log(removeConsonantsText); // Output: eo oo
console.log(repeatedText); // Output: HelloHelloHello
console.log(truncatedText); // Output: Hello...
console.log(paddedText); // Output:      Hello
console.log(containsSubstringText); // Output: true
console.log(replacedAllText); // Output: Hella Warld
console.log(splitByCommaText); // Output: ['Hello', 'World', 'JavaScript']
console.log(removeNumbersText); // Output: Hello
console.log(extractNumbersText); // Output: ['123', '456']
console.log(removePunctuationText); // Output: Hello World
console.log(isUpperCaseText); // Output: true
console.log(isLowerCaseText); // Output: true
console.log(countWordsText); // Output: 2
console.log(countCharactersText); // Output: 11
console.log(countVowelsText); // Output: 3
console.log(countConsonantsText); // Output: 7
console.log(countDigitsText); // Output: 3
console.log(startsWithText); // Output: true
console.log(endsWithText); // Output: true
console.log(repeatEachCharacterText); // Output: HHeelllloo
console.log(removeDuplicateCharactersText); // Output: Helo Wrd
console.log(removeWhitespaceText); // Output: HelloWorld
console.log(insertStringText); // Output: Hello Beautiful World
console.log(pascalCaseText); // Output: HelloWorld
console.log(dotCaseText); // Output: hello.world
console.log(toggleCaseText); // Output: hELLO wORLD
console.log(swapCaseText); // Output: hELLO wORLD
console.log(shuffledStringText); // Output: e.g. "W lldroHeol"
console.log(sortedCharactersText); // Output: " HdellloorW"
console.log(isAnagramText); // Output: true
console.log(containsOnlyLettersText); // Output: true
console.log(containsOnlyNumbersText); // Output: true
console.log(containsOnlyAlphanumericText); // Output: true
console.log(convertTabsToSpacesText); // Output: "    Hello    World"
console.log(convertSpacesToTabsText); // Output: "\tHello\tWorld"
console.log(escapeHTMLText); // Output: "&lt;div&gt;Hello World&lt;/div&gt;"
console.log(unescapeHTMLText); // Output: "<div>Hello World</div>"
console.log(stripHTMLTagsText); // Output: "Hello World"

License

This project is licensed under the MIT License.