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

@nimoh-digital-solutions/tast-utils

v1.1.6

Published

Utility functions, types, and HTTP client for tast projects

Readme

@nimoh-digital-solutions/tast-utils

General-purpose utility functions, types, and an HTTP client for the TAST ecosystem. Zero runtime dependencies.

npm

Installation

npm install @nimoh-digital-solutions/tast-utils
# or
yarn add @nimoh-digital-solutions/tast-utils

No peer or runtime dependencies required.

API reference

HTTP client

A typed fetch wrapper with interceptors, configurable timeout, and credentials support.

import { createHttpClient, HttpError } from '@nimoh-digital-solutions/tast-utils';

const http = createHttpClient({
  baseUrl: 'https://api.example.com',
  timeout: 15_000,           // default: 30 000 ms
  credentials: 'include',    // send cookies
});

// Typed requests
const users = await http.get<User[]>('/users');
const user = await http.post<User>('/users', { name: 'Alice' });
await http.put<User>('/users/1', { name: 'Bob' });
await http.patch<User>('/users/1', { email: '[email protected]' });
await http.delete('/users/1');

Interceptors

// Add auth header to every request
http.addRequestInterceptor(async (ctx) => {
  ctx.headers.set('Authorization', `Bearer ${getToken()}`);
  return ctx;
});

// Handle 401 globally
http.addErrorInterceptor(async (error) => {
  if (error instanceof HttpError && error.status === 401) {
    await refreshToken();
    // retry…
  }
  throw error;
});

HttpError

Thrown on non-2xx responses. Exposes status and body properties.

try {
  await http.get('/protected');
} catch (err) {
  if (err instanceof HttpError) {
    console.log(err.status); // 403
    console.log(err.body);   // parsed JSON body
  }
}

Formatters

import { formatDate, truncateString, capitalize } from '@nimoh-digital-solutions/tast-utils';

formatDate(new Date());                              // "Feb 28, 2026"
formatDate(new Date(), { dateStyle: 'full' }, 'fr'); // "samedi 28 février 2026"
truncateString('Hello world', 8);                    // "Hello…"
truncateString('Hello world', 8, '...');             // "Hello..."
capitalize('hello');                                 // "Hello"

Helpers

import { debounce, throttle, generateId, isEmpty, deepClone } from '@nimoh-digital-solutions/tast-utils';

| Function | Signature | Description | |---|---|---| | debounce(fn, wait) | (fn, ms) => DebouncedFn | Debounce with .cancel() method | | throttle(fn, limit) | (fn, ms) => ThrottledFn | Leading-edge throttle | | generateId(length?) | (n?) => string | Random ID via crypto.randomUUID (fallback: Math.random) | | isEmpty(value) | (v) => boolean | Null/empty check for strings, arrays, objects, Maps, Sets | | deepClone<T>(obj) | (obj) => T | Deep clone via structuredClone (manual fallback) |


Storage

Safe localStorage wrappers that never throw. Sensitive keys (token, secret, password, auth) are blocked from being written.

import {
  getStorageItem,
  setStorageItem,
  removeStorageItem,
  clearStorage,
  hasStorageItem,
} from '@nimoh-digital-solutions/tast-utils';

setStorageItem('user', { id: '1', name: 'Alice' });
const user = getStorageItem<User>('user');         // User | null
const exists = hasStorageItem('user');              // true
removeStorageItem('user');
clearStorage();

PWA utilities

Comprehensive Progressive Web App helpers.

import {
  registerPWAInstallPromptListener,
  canPromptPWAInstall,
  promptPWAInstall,
  isPWA,
  getDisplayMode,
  isIOS,
  isAndroid,
  supportsServiceWorker,
  getConnectionType,
  isSlowConnection,
  getAppVersionFromSW,
} from '@nimoh-digital-solutions/tast-utils';

// Capture the install prompt event
registerPWAInstallPromptListener();

// Check and trigger install
if (canPromptPWAInstall()) {
  const result = await promptPWAInstall(); // 'accepted' | 'dismissed' | null
}

// Platform & mode detection
isPWA();                  // true if running as installed PWA
getDisplayMode();         // 'standalone' | 'browser' | ...
isIOS();                  // handles iPadOS
isSlowConnection();       // true on 2G/slow-2G

Types

Reusable TypeScript types for API responses and app patterns:

import type {
  ApiResponse,
  PaginatedResponse,
  ProblemDetail,         // RFC 7807
  Theme,
  DisplayMode,
  ConnectionType,
  PWAConfig,
  WorkboxConfig,
} from '@nimoh-digital-solutions/tast-utils';

Development

This package lives in the TAST monorepo.

yarn packages:build   # Build all packages
yarn test             # Run tests (Vitest)

License

MIT