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

@regardio/js

v0.7.1

Published

Regardio JavaScript utilities

Readme

@regardio/js

TypeScript utilities for Regardio applications

A collection of lightweight, tree-shakeable utility functions for common tasks like text manipulation, HTTP handling, internationalization, time formatting, and validation.

⚠️ Pre-release Notice

This package is currently in pre-release (v0.x). While we use these utilities in production across our own projects, the API may still change between minor versions. We recommend:

  • Pinning to exact versions in your package.json
  • Reviewing changelogs before upgrading
  • Expecting potential breaking changes until v1.0

Why This Package?

We created @regardio/js to:

  • Share battle-tested utilities — These functions power real Regardio projects and have been refined through actual use
  • Reduce boilerplate — Common patterns like text formatting, cookie handling, language detection, and time formatting in one place
  • Stay framework-agnostic — Works with any JavaScript/TypeScript project (React, Node, Deno, etc.)
  • Enable tree-shaking — Import only what you need; unused utilities won't bloat your bundle

Installation

pnpm add @regardio/js

Modules

@regardio/js/text

String manipulation and formatting utilities.

import {
  typographicQuotes,
  truncateText,
  splitIntoSentences,
  formatBytes,
  parseAuthorString,
} from '@regardio/js/text';

typographicQuotes('"Hello"', 'de'); // „Hello"
truncateText('Hello world', 8); // "Hello..."
formatBytes(1500000); // "1.5 MB"
parseAuthorString('John <[email protected]>'); // { name: 'John', email: '[email protected]' }

@regardio/js/time

Date, time, and async utilities.

import {
  timeAgo,
  friendlyDuration,
  oneWeekFromNow,
  delay,
  measure,
} from '@regardio/js/time';

timeAgo(new Date('2024-01-01')); // "3 months ago"
friendlyDuration(150, 'en', true); // { key: 'common:duration.hoursAndMinutesShort', vars: {...} }
await delay(1000); // Wait 1 second
await measure('fetchData', () => fetch('/api')); // Logs timing

@regardio/js/http

HTTP, cookie, and routing utilities.

import {
  getCookieValue,
  setCookieValue,
  createDomain,
  getCleanUrl,
  isRouteActive,
} from '@regardio/js/http';

setCookieValue('theme', 'dark', { path: '/', secure: true });
const theme = getCookieValue('theme');
const domain = createDomain(request); // "https://example.com"
isRouteActive('/account', '/account/settings', false); // true

@regardio/js/intl

Server-side language detection for i18n.

import { LanguageDetector } from '@regardio/js/intl';

const detector = new LanguageDetector({
  supportedLanguages: ['en', 'de'],
  fallbackLanguage: 'en',
});

const locale = await detector.detect(request);

@regardio/js/assert

Runtime assertion and validation utilities.

import { invariant, invariantResponse, verifyAccept } from '@regardio/js/assert';

invariant(user, 'User not found'); // Throws Error if falsy
invariantResponse(user, 'User not found', { status: 404 }); // Throws Response
verifyAccept('image/png', 'image/*'); // true

@regardio/js/encoding

Binary encoding utilities.

import { urlBase64ToUint8Array } from '@regardio/js/encoding';

const bytes = urlBase64ToUint8Array(vapidPublicKey);

Module Overview

| Module | Description | |--------|-------------| | @regardio/js/text | String manipulation, formatting, author parsing | | @regardio/js/time | Time formatting, delays, performance measurement | | @regardio/js/http | Cookies, domain extraction, route matching | | @regardio/js/intl | Server-side language detection for i18n | | @regardio/js/assert | Runtime assertions and MIME validation | | @regardio/js/encoding | Base64 and binary conversions |

Contributing

This package is primarily maintained for Regardio's internal use, but we welcome:

  • Bug reports and fixes
  • Documentation improvements
  • Feature suggestions (though we may not implement all requests)

License

MIT License — Free to use in commercial and open source projects.


Part of the Regardio Ensemble toolkit for collective well-being.