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

@dirstack/utils

v1.8.0

Published

A lightweight set of utilities

Downloads

3,669

Readme

@dirstack/utils

A lightweight, dependency-light set of TypeScript utilities shared across projects. Tree-shakeable, ESM-first (with a CommonJS build), and fully typed.

Install

bun add @dirstack/utils
# or: npm install @dirstack/utils

Usage

Everything is exported from the package root:

import { chunk, clamp, formatBytes, slugify, tryCatch } from "@dirstack/utils"

chunk([1, 2, 3, 4, 5], 2) // [[1, 2], [3, 4], [5]]
clamp(12, 0, 10) // 10
formatBytes(1536, 1) // "1.5 KB"
slugify("Hello World") // "hello-world"

const { data, error } = await tryCatch(fetch("/api"))

What's inside

| Module | Highlights | | --- | --- | | array | uniq, uniqBy, chunk, groupBy, keyBy, countBy, compact, sortBy, sum, sumBy, range | | batch | processBatch, processBatchWithErrorHandling (ordered, concurrency-limited, with onProgress) | | colors | isLightColor | | dom | getElementPosition, getShortcutLabel, toBase64, setInputValue | | errors | isErrorWithMessage, toErrorWithMessage, getErrorMessage | | events | subscribe, unsubscribe, publish, publishEscape | | format | formatNumber, formatCurrency, formatBytes, formatMimeType, isMimeTypeMatch | | helpers | sleep, isTruthy, tryCatch, debounce, throttle, retry | | http | isValidUrl, normalizeUrl, getDomain, joinUrlPaths, query-param helpers, checkUrlAvailability | | numbers | clamp, parseNumericValue, preciseRound | | objects | pick, omit, isEmptyObject, sortObject, nullsToUndefined | | pagination | getCurrentPage, getPageParams, getPageLink | | parsers | maybeParseJson, maybeStringifyJson, serialize, deserialize | | random | getRandomColor, getRandomString, getRandomNumber, getRandomElement | | string | ucFirst, lcFirst, stripHtml, getExcerpt, slugify, getInitials, joinAsSentence | | time | formatDate, formatTime, formatDateTime, formatDateRange, getReadTime |

Some utilities (dom, events, toBase64, setInputValue) rely on browser APIs and are only usable in the browser.

Development

bun install      # install dependencies
bun test         # run the test suite
bun run typecheck
bun run build    # bundle + emit type declarations

License

MIT © Piotr Kulpinski