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

@simjrlouz/catchless

v1.0.0

Published

Stop try/catch hell. Handle errors as data.

Downloads

49

Readme

🎣 Catchless

Stop the try/catch hell. Handle async errors like a pro. En finissez avec l’enfer des try/catch. Gérez vos erreurs asynchrones comme un pro.

Bundle Size Language


💡 Why Catchless? / Pourquoi Catchless ?

EN: In JavaScript/TypeScript, handling async errors often leads to deeply nested code and unreadable try/catch blocks. Catchless brings the “Error as Data” pattern (inspired by Go and Rust) to your codebase, making your code linear, clean, and type-safe.

FR : En JavaScript/TypeScript, la gestion des erreurs asynchrones mène souvent à un code imbriqué et des blocs try/catch illisibles. Catchless introduit le pattern « l’erreur comme donnée » (inspiré de Go et Rust) pour un code plus lisible, linéaire et sécurisé (type-safe).


🔍 Comparison / Comparaison

❌ Before / Avant

async function getUser() {
  try {
    const res = await fetch('/api/user');
    const user = await res.json();
    return user;
  } catch (error) {
    console.error(error);
    return null;
  }
}

✅ With Catchless / Avec Catchless

import { safe } from 'catchless';

async function getUser() {
  const [user, err] = await safe(api.getUser());

  if (err) {
    console.error(err);
    return null;
  }

  return user;
}

📦 Installation

npm install catchless
# or / ou
yarn add catchless
# or / ou
pnpm add catchless

🛠 Features / Fonctionnalités

1️⃣ Simple Safe Call

EN: Wraps any promise into a simple [data, error] tuple. FR : Enveloppe n’importe quelle promesse dans un tuple [data, error].

const [data, err] = await safe(myPromise);

2️⃣ With Timeout

EN: Prevents your application from hanging forever if an API is too slow. FR : Empêche votre application de rester bloquée si une API est trop lente.

// Fails if not resolved after 2000ms
const [data, err] = await safeWithTimeout(api.getData(), 2000);

3️⃣ Fully Type-Safe

EN: Automatically infers data types. No more any. FR : Inférence automatique des types. Fini le any.

const [user, err] = await safe<User>(fetchUser());

// user: User | null
// err: Error | null

🧩 Advanced Usage / Usage Avancé

EN: Specify a custom error type for domain-specific error handling. FR : Spécifiez un type d’erreur personnalisé pour une meilleure gestion métier.

type MyApiError = {
  code: number;
  message: string;
};

const [data, err] = await safe<User, MyApiError>(fetchUser());

if (err) {
  console.log(err.code);
}

📊 Benefits / Avantages

  • Zero Dependencies — Built with pure TypeScript
  • Ultra-lightweight — Less than 500 bytes (minified + gzipped)
  • Linear Flow — Reduces cognitive load by removing deep nesting

  • Zéro dépendance — Construit en pur TypeScript
  • Ultra-léger — Moins de 500 octets (minifié + gzippé)
  • Flux linéaire — Réduit la charge cognitive en supprimant l’imbrication

🤝 Contributing

EN: Contributions are welcome! Feel free to open an issue or a pull request. FR : Les contributions sont les bienvenues ! Ouvrez une issue ou une pull request.


📄 License

MIT © LOUZOLO Sim-Jr Steeven / sim-jr