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

@dvirus-js/utils

v1.0.3

Published

This package provides a collection of utility functions for string manipulation, data transformation, async handling, HTTP requests, and more. It is designed to be a shared resource for other packages in the monorepo.

Readme

Utils Library

This package provides a collection of utility functions for string manipulation, data transformation, async handling, HTTP requests, and more. It is designed to be a shared resource for other packages in the monorepo.

Available Utilities

convert-cases.ts

Convert strings between various case formats (camelCase, PascalCase, snake_case, kebab-case, etc.) and normalize strings.

import { convertCase, normalizeString } from './lib/convert-cases';

const input = 'HelloWorld_example-string';
console.log(normalizeString(input)); // 'hello world example string'
console.log(convertCase(input, 'snake_case')); // 'hello_world_example_string'
console.log(convertCase(input, 'camelCase')); // 'helloWorldExampleString'

tryCatch.ts

Async error handling for promises, returning a tuple of [result, error].

import { tryCatch } from './lib/tryCatch';

const [data, error] = await tryCatch(fetch('/api/data'));
if (error) {
  // handle error
}

http.ts

Simple HTTP client for GET, POST, PUT, PATCH, DELETE requests using fetch.

import { http } from './lib/http';

const data = await http.get('/api/data');
const created = await http.post('/api/data', { name: 'test' });

group-by.ts

Group array items by a key.

import { groupBy } from './lib/group-by';

const arr = [ { type: 'a', v: 1 }, { type: 'b', v: 2 }, { type: 'a', v: 3 } ];
const grouped = groupBy(arr, x => x.type);
// { a: [{type:'a',v:1},{type:'a',v:3}], b: [{type:'b',v:2}] }

delay.ts

Delay execution, clamp values, and debounce functions.

import { delay, clamp, debounce } from './lib/delay';

await delay(500); // waits 500ms
const clamped = clamp(0, 10, 5); // 5
const debounced = debounce(() => console.log('run'), 300);
debounced();

getProp.ts

Get a deeply nested property from an object using a string path, with type safety.

import { getProp } from './lib/getProp';

const obj = { a: { b: { c: 42 } } };
const value = getProp(obj, 'a.b.c'); // 42

Result.ts

A Result type for functional error handling (ok/err pattern).

import { Result } from './lib/Result';

const res = Result.func(() => JSON.parse('{bad json}'));
if (res.isErr()) {
  console.error(res.error);
}

toObject.ts

Convert an array to an object by key, or ensure a value is always an array.

import { toObject, toArray } from './lib/toObject';

const arr = [{ id: 1 }, { id: 2 }];
const obj = toObject(arr, x => x.id); // { '1': {id:1}, '2': {id:2} }
const arr2 = toArray('foo'); // ['foo']

This library was generated with Nx.