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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@walkup/walkup-utils

v1.1.0

Published

A collection of lightweight utility functions for web development

Readme

@walkup/walkup-utils

npm version Build Status License: MIT

A lightweight, TypeScript-first collection of essential utility functions for modern web development.
Currently includes a resilient tryCatch helper for wrapping Promise calls into a safe Result<T, E> union.


Table of Contents


Installation

npm install @walkup/walkup-utils
# or
yarn add @walkup/walkup-utils
# or
pnpm add @walkup/walkup-utils
# or
bun add @walkup/walkup-utils

Usage

import { debounce, tryCatch } from '@walkup/walkup-utils';

// Debounce example:
const onResize = debounce(() => {
  console.log(`Resized to: ${window.innerWidth}×${window.innerHeight}`);
}, 200);
window.addEventListener('resize', onResize);

// tryCatch example:
async function main() {
  const result = await tryCatch(
    fetch('https://example.com').then((r) => r.json())
  );

  if (result.data) {
    console.log('Success:', result.data);
  } else {
    console.error('Error:', result.error);
  }
}

API Reference

debounce

Creates a debounced version of the provided function, delaying its invocation until after a specified wait time has elapsed since the last call.

Parameters

| Name | Type | Description | | :----- | :------- | :------------------------------------------------------------------- | | fn | F | The function to debounce; invoked with the last arguments after wait | | wait | number | Milliseconds to wait after the last call before invoking fn. |

Returns

(...args: Parameters<F>) => void A debounced wrapper around fn that returns void.


tryCatch

Wraps any promise and returns a Result<T, E> instead of throwing.

Type Parameters

| Name | Type | Default | | :--- | :------ | :------ | | T | any | any | | E | Error | Error |

Parameters

| Name | Type | Description | | :-------- | :-------------- | :--------------------------- | | promise | Promise<T> | A Promise that resolves to T |

Returns

Promise<Result<T, E>>


Types

Success

| Name | Type | | :------ | :----- | | data | T | | error | null |

Failure

| Name | Type | | :------ | :----- | | data | null | | error | E |

Result

The discriminated union Result<T, E> – either a Success<T> or a Failure<E> (defaults to Error)

| Name | Type | | :--- | :------ | | T | any | | E | Error |


Development

Build

npm run build

Testing

npm run test

Linting & Formatting

npm run lint
npm run format

Contributing

Contributions are welcome! Please:

Fork the repository.

Create a feature branch (git checkout -b feat/my-helper).

Add your utility under src/, write accompanying tests and update src/index.ts.

Run npm test && npm run build to ensure everything passes.

Open a pull request against the main branch, describing your changes.

Please adhere to the existing code style and add unit tests for any new functionality.

Changelog

See CHANGELOG.md.

License

MIT License.
Copyright (c) 2023 Dustin Walkup

Author

👤 Dustin Walkup


Made with contributors-img.
This project follows the all-contributors specification. Contributions of any kind welcome!