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

extends-string

v1.0.0

Published

extra String methods

Downloads

31

Readme

extends-string

NPM version Build Status

This is a tool that provides extra String methods. It allows to perform some actions more easily with Strings types which makes it simpler, more flexible, more practical and less effort.

Installation

# Using npm
npm install --save extends-string

Usage

const Str = require('extends-string');

// Syntax : Str(string).countOccurencesOf(word)
Str('This is an example!').countOccurencesOf('is'); // expected output: 2
// Syntax : Str(string).encryptInOccurencesFormat()
Str('This is an example!').encryptInOccurencesFormat(); // expected output: 1T1h2i2s32a1n2e1x1m1p1l1!
Str('aabdccczxxxxx').encryptInOccurencesFormat(); // expected output: 2a1b1d3c1z5x

// Syntax : Str(string).removeByIndex(index)
Str('This is an example!').removeByIndex(2); // expected output: Ths is an example!
// Syntax : Str(string).removeWord(word)
Str('This is one of one an example!').removeWord('one'); // expected output: This is  of one an example!
// Syntax : Str(string).removeWordAll(word)
Str('This is one of one an example!').removeWordAll('one'); // expected output: This is  of  an example!

// Syntax : Str(string).reverse()
Str('This is an example!').reverse(); // expected output: !elpmaxe na si sihT

// Syntax : Str(string).add(index, word)
Str('This is an example!').add(8, 'one of '); // expected output: This is one of an example!
// Syntax : Str(string).addInHead(word)
Str('This is an example!').addInHead('Hi! '); // expected output: Hi! This is an example!
// Syntax : Str(string).addInEnd(word)
Str('This is an example!').addInEnd('!'); // expected output: This is an example!!

// Syntax : Str(string).upperByIndex(index)
Str('this is an example!').upperByIndex(0); // expected output: This is an example!
// Syntax : Str(string).upperWord(word)
Str('this is an example!').upperWord('is'); // expected output: thIS is an example!
// Syntax : Str(string).upperWordAll(word);
Str('this is an example!').upperWordAll('is'); // expected output: thIS IS an example!

// Syntax : Str(string).lowerByIndex(index)
Str('THIS IS AN EXAMPLE!').lowerByIndex(0); // expected output: tHIS IS AN EXAMPLE!
// Syntax : Str(string).lowerWord(word)
Str('THIS IS AN EXAMPLE!').lowerWord('IS'); // expected output: THis IS AN EXAMPLE!
// Syntax : Str(string).lowerWordAll(word)
Str('THIS IS AN EXAMPLE!').lowerWordAll('IS'); // expected output: THis is AN EXAMPLE!

// Syntax : Str(string).splice(start, countEnd, word)
Str('This is an example!').splice(0, 9, 'I am the new'); // expected output: I am the new example!