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

stri

v1.0.293

Published

Yet another helper tool for string manipulation.

Downloads

9

Readme

Here goes yet another string manipulation package.

Another one!?

Well, there are many other string npm packages, like string and others. stri contains functionality that I need, but other packages miss. Only a handful of functions, but useful ones.

Installation

npm i stri -S

Usage

To have all functions at your disposal, import it and then do this in your main:

Stri.includeMe()

After that all methods will be available as String members.

Methods

Methods

between

Static between(s, borderA, borderB, aIsFirst, bIsFirst): stringOrUndefined

returns string between borders

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | s | stringOrUndefined | - | | borderA | stringOrUndefined | left border | | borderB | stringOrUndefined | right border | | aIsFirst | boolean | true if borderA is first, false if is last | | bIsFirst | boolean | true if borderB is first, false if is last |

Returns

stringOrUndefined

Defined in

index.ts:103


cutFirst

Static cutFirst(s, splitter): stringOrUndefined

fast way to cut away a first part split by smth, for instance "lalala/hahaha/bebebe".cutFirst('/') will return "hahaha/bebebe"

Parameters

| Name | Type | | :------ | :------ | | s | stringOrUndefined | | splitter | stringOrUndefined |

Returns

stringOrUndefined

Defined in

index.ts:38


cutLast

Static cutLast(s, splitter): stringOrUndefined

fast way to cut away a last part split by smth, for instance "lalala/hahaha/bebebe".cutLast('/') will return "lalala/hahaha"

Parameters

| Name | Type | | :------ | :------ | | s | stringOrUndefined | | splitter | stringOrUndefined |

Returns

stringOrUndefined

Defined in

index.ts:27


getBetween

Static getBetween(s, borderA, borderB): stringOrUndefined

returns string between borderA and B. Gets between the first A and the LAST B

Parameters

| Name | Type | | :------ | :------ | | s | stringOrUndefined | | borderA | stringOrUndefined | | borderB | stringOrUndefined |

Returns

stringOrUndefined

Defined in

index.ts:80


getBetweenClose

Static getBetweenClose(s, borderA, borderB): stringOrUndefined

returns string between borderA and B. Gets between the FIRST A and the FIRST B

Parameters

| Name | Type | | :------ | :------ | | s | stringOrUndefined | | borderA | stringOrUndefined | | borderB | stringOrUndefined |

Returns

stringOrUndefined

Defined in

index.ts:89


getFirst

Static getFirst(s, splitter): stringOrUndefined

fast way get the first part split by smth, for instance "lalala/hahaha/bebebe".getFirst('/') will return "lalala"

Parameters

| Name | Type | | :------ | :------ | | s | stringOrUndefined | | splitter | stringOrUndefined |

Returns

stringOrUndefined

Defined in

index.ts:58


getLast

Static getLast(s, splitter): stringOrUndefined

fast way to get the last part split by smth, for instance "lalala/hahaha/bebebe".getLast('/') will return "bebebe"

Parameters

| Name | Type | | :------ | :------ | | s | stringOrUndefined | | splitter | stringOrUndefined |

Returns

stringOrUndefined

Defined in

index.ts:49


has

Static has(s, what): boolean

does this string contain what?

Parameters

| Name | Type | | :------ | :------ | | s | stringOrUndefined | | what | string |

Returns

boolean

Defined in

index.ts:73


includeMe

Static includeMe(): string

needs to be called once in the very beginning of your app

Returns

string

Defined in

index.ts:18


oust

Static oust(s, what): boolean

Removes all whats in the string In fact, same as str.split(what).join('')

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | s | stringOrUndefined | - | | what | stringOrUndefined | what to remove |

Returns

boolean

Defined in

index.ts:117


swap

Static swap(s, from, to): undefined | string

Replaces from with to

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | s | stringOrUndefined | - | | from | stringOrUndefined | what to replace | | to | stringOrUndefined | to what to replace |

Returns

undefined | string

Defined in

index.ts:67