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 🙏

© 2025 – Pkg Stats / Ryan Hefner

strrr

v0.1.0

Published

Functional string utilities

Downloads

10

Readme

strrr

Functional string utilities, inspired by Laravel's Str helpers.

Travis npm

Installation

yarn add strrr

Usage

chainability built in. e.g.

str('lorem ipsum dolor sit amet')
  .title()
  .limit(10)
  .pipe(s => doSomething(s))
  .get();

// = 'Lorem Ipsu…'

Available Methods

limit

Limit a string to a given length with a suffix (ellipsis).

Method signature

limit(limit = 100, end = '…');

import { str } from 'strrr';

str('lorem ipsum dolor sit amet').limit(20).get();
// = 'Lorem ipsum dolor si…'

words

Limit the number of words in a string with a suffix (ellipsis).

Method signature

words(words = 100, end = '…');

import { str } from 'strrr';

str('lorem ipsum dolor sit amet').words(3).get();
// = 'Lorem ipsum dolor…'

random

Generate a "random" alpha-numeric string.

Method signature

random(length = 32)

import { random } from 'strrr';

random().get(); // = 'nKusDo5JIFrI1tJswwzpEyGLpvML1Mxp'
random(16).get(); // = 'Ky6zJuGnGyrnvw1y'

title

Convert the string to Title case.

Method signature

title()

import { str } from 'strrr';

str('lorem ipsum dolor sit amet').title().get();
// = 'Lorem Ipsum Dolor Sit Amet'

studly

Convert the string to Studly case. Also known as pascal case

Method signature

studly()

import { str } from 'strrr';

str('lorem_ipsum_dolor_sit_amet').studly().get();
// = 'LoremIpsumDolorSitAmet'

camel

Convert the string to camel case

Method signature

camel()

import { str } from 'strrr';

str('lorem_ipsum_dolor_sit_amet').camel().get();
// = 'loremIpsumDolorSitAmet'

snake

Convert the string to snake case

Method signature

snake(delimeter = '_')

import { str } from 'strrr';

str('LoremIpsumDolorSitAmet').snake().get();
// = 'lorem_ipsum_dolor_sit_amet'

kebab

Convert the string to kebab case - Which is similar to snake case but with dashes.

Method signature

kebab()

import { str } from 'strrr';

str('LoremIpsumDolorSitAmet').kebab().get();
// = 'lorem-ipsum-dolor-sit-amet'

ucfirst

Capitalize the first character in a string.

Method signature

ucfirst()

import { str } from 'strrr';

str('foo bar').ucfirst().get(); // = 'Foo bar'

lcfirst

lower case the first character in a string.

Method signature

lcfirst()

import { str } from 'strrr';

str('Lorem ipsum').lcfirst().get(); // = 'lorem ipsum'

contains

Determine if a given string contains a given string.

Method signature

contains(val, position = 0)

import { str } from 'strrr';

str('foobarbaz').contains('bar'); // = true
str('foobarbaz').contains('bob'); // = false

startsWith

Determine if a given string starts with a given string.

Method signature

startsWith(val, position = 0)

import { str } from 'strrr';

str('Lorem ipsum dolor sit amet').startsWith('Lorem') // = true
str('Lorem ipsum dolor sit amet').startsWith('ipsum') // = false

endsWith

Determine if a given string ends with a given string.

Method signature

endsWith(val, position = 0)

import { str } from 'strrr';

str('Lorem ipsum dolor sit amet').endsWith('amet'); // = true
str('Lorem ipsum dolor sit amet').endsWith('ipsum'); // = false

isLowerCase

Determine if the string is lowercase.

Method signature

isLowerCase()

import { str } from 'strrr';

str('lorem ipsum dolor sit amet').isLowerCase(); // = true
str('Lorem ipsum dolor sit amet').isLowerCase(); // = false

isUpperCase

Determine if the string is uppercase.

Method signature

isUpperCase()

import { str } from 'strrr';

str('LORUM').isUpperCase(); // = true
str('LoRuM').isUpperCase(); // = false

strip

Strip all whitespace from a string.

Method signature

strip()

import { str } from 'strrr';

str(' Lorem ipsum dolor sit amet  ').strip().get()
// = 'Loremipsumdolorsitamet'

ascii

Transliterate a UTF-8 value to ASCII.

Method signature

ascii()

import { str } from 'strrr';

str('I ♥ javascript').ascii().get() // = 'I love javascript'
str('@ðẻ-₀ფف').ascii().get() // = 'atde-0ff'

slug

Generate a URL friendly "slug" from the string.

Method signature

slug(separator = '-')

import { str } from 'strrr';

str('FOO bar baz').slug().get() // = 'foo-bar-baz'
str('I ♥ javascript').slug('_').get() // = 'i_love_javascript'