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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@billdaddy/strkit

v0.1.1

Published

Tiny, type-safe string utilities — truncate, template, escapeHtml/escapeRegExp, dedent, center, and prefix/suffix helpers. Zero dependencies.

Downloads

229

Readme

strkit

All Contributors

Tiny, type-safe string utilitiestruncate, template, escapeHtml/escapeRegExp, dedent, center, and prefix/suffix helpers. Zero dependencies.

CI npm version bundle size types license

JS strings got padStart, trimEnd, and replaceAll — but you still hand-roll truncate, escapeHtml, escapeRegExp, and a tiny {{template}} in every project. strkit is those everyday string helpers, done once and tested, fully typed and tree-shakeable.

import { truncate, template, escapeHtml } from "@billdaddy/strkit";

truncate("The quick brown fox", 12);          // "The quick b…"
template("Hi {{name}}", { name: "Sam" });      // "Hi Sam"
escapeHtml('<a href="x">');                    // "&lt;a href=&quot;x&quot;&gt;"

Why strkit?

  • Smart truncation. truncate counts the ellipsis in the limit and can cut on a word boundary; truncateMiddle keeps both ends (paths, hashes).
  • Safe escaping. escapeHtml/unescapeHtml for markup, escapeRegExp for building patterns from user input.
  • Tiny templating. template fills {{placeholders}} with custom delimiters and a fallback.
  • The little fixers. capitalize, center, dedent, ensurePrefix/Suffix, stripPrefix/Suffix.
  • Tree-shakeable. sideEffects: false, ESM + CJS, zero dependencies.

Install

npm install @billdaddy/strkit
# or: pnpm add @billdaddy/strkit  /  yarn add @billdaddy/strkit  /  bun add @billdaddy/strkit

Truncation

import { truncate, truncateMiddle } from "@billdaddy/strkit";

truncate("The quick brown fox", 9);                        // "The quic…"
truncate("The quick brown fox", 9, { wordBoundary: true }); // "The…"
truncate("abcdefgh", 6, { ellipsis: "..." });              // "abc..."
truncateMiddle("0x1234567890abcdef", 11);                  // "0x123…bcdef"

Escaping & templating

import { escapeHtml, unescapeHtml, escapeRegExp, template } from "@billdaddy/strkit";

escapeHtml("Tom & Jerry");                 // "Tom &amp; Jerry"
unescapeHtml("it&#39;s");                  // "it's"
new RegExp(escapeRegExp("a.b(c)"));        // matches the literal text

template("{{a}} + {{b}} = {{c}}", { a: 1, b: 2, c: 3 }); // "1 + 2 = 3"
template("[%x%]", { x: "y" }, { open: "[%", close: "%]" }); // "y"
template("{{a}} {{b}}", { a: 1 }, { fallback: "?" });    // "1 ?"

Unknown keys are left as-is by default; null/undefined become empty strings.

Transforms

import {
  capitalize, uncapitalize, center, dedent,
  ensurePrefix, ensureSuffix, stripPrefix, stripSuffix,
} from "@billdaddy/strkit";

capitalize("hello");          // "Hello"
center("hi", 6);              // "  hi  "
ensurePrefix("path", "/");    // "/path"
stripSuffix("file.ts", ".ts"); // "file"

dedent(`
  SELECT *
    FROM users
`); // "SELECT *\n  FROM users"

Pairs well with

| Need | Use | | --- | --- | | Convert case (camel/snake/kebab) | @billdaddy/casekit | | Slugify text for URLs | slugkit |

Contributors ✨

This project follows the all-contributors specification. Contributions of any kind are welcome — code, docs, bug reports, ideas, reviews! See the emoji key for how each contribution is recognized, and open a PR or issue to get involved.

Thanks goes to these wonderful people:

License

MIT © Tung Tran