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

string-edit

v1.2.14

Published

Easy-to-Use String Edit and String Tools.

Downloads

51

Readme

String Edit

  • String Edit and String Tools
  • Easy-to-Use

Installation

npm install --save string-edit

Features

  • Latinization of text
  • Removal of letters, number or special characters
  • Random case, alternating case
  • And many more...

Usage

const stringEdit = require("string-edit");

//Alternate case
stringEdit.alternateCase("my name is john"); // => "My NaMe Is JoHn"
stringEdit.alternateCase("my name is john", false, false); // => "mY NaMe iS JoHn"

//Reverse case
stringEdit.reverseCase("hEllO, WhaT'S Up?"); // => "HeLLo, wHAt's uP?"

//Find character's indexes
stringEdit.findCharIndexes("potato potatoes", "o"); // => [ 1, 5, 8, 12 ]

Functions

latinize(string)

This function latinizes the string. For example: "héľĺô woŕlď" -> "hello world"

string

Type: string The string to be latinized.

removeNumbers(string)

This function removes numbers. For example: "1orange 2apples 3strawberries" -> "orange apples strawberries"

string

Type: string The string where the numbers will be removed.

removeLetters(string)

This function removes letters. For example: "1orange 2apples 3strawberries 4úäňô" -> "1 2 3 4"

string

Type: string The string where the letters will be removed.

removeSpecialCharacters(string)

This function removes special characters except whitespace. For example: "hel-lo. wor,ld!" -> "hello world"

string

Type: string The string where the special characters will be removed.

randomCase(string)

This function randomizes the case of characters. For example: "apple" -> "aPPlE"

string

Type: string The string where the case will be randomized.

alternateCase(string, start_with_uppercase, ignore_whitespace)

This function alternates the case of characters. For example: "strawberry" -> "StRaWbErRy"

string

Type: string The string where the case will be alternated.

start_with_uppercase

Type: boolean Default value: true The alternating case will start with uppercase if true.

ignore_whitespace

Type: boolean Default value: true Whitespaces will be ignored (they won't count as character) if true.

reverseContent(string)

This function reverses the string. For example: "orange" -> "egnaro"

string

Type: string The string to be reversed.

reverseCase(string)

This function reverses case of every character in the string. For example: "HelLo" -> "hELlO"

string

Type: string The string where the case will be reversed.

findCharIndexes(string, to_find)

This function finds every specific character's index in the string. For example: "potato", "o" -> [ 1, 5 ]

string

Type: string The string that you want to search through.

to_find

Type: string The character to be found.

extractCharacters(string, to_array, repeat_characters)

This function extracts every character in the string to array or string. For example: "feeling!" -> [ "f", "e", "l", "i", "n", "g", "!" ] or "fe.el" -> "fe.l"

string

Type: string The string with characters that will extracted.

to_array

Type: boolean Default value: true Characters will be extracted to array if true (otherwise to string).

repeat_characters

Type: boolean Default value: false Characters won't repeat if false.

shuffle(string)

This function shuffles the string. For example: "entity" -> "tyetin"

string

Type: string The string to be shuffled.

randomJoin(array, join_specific_amount)

This function joins strings from array randomly. For example: [ "ab", "cd", "ef" ] -> "cdefab" or [ "ab", "cd", "ef" ] -> "efcd"

array

Type: array The array from which the strings will be joined.

join_specific_amount

Type: number Default value: 0 The amount of strings to be joined (needs to be greater than 0).