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

@armadacore/essentials

v0.3.0

Published

Foundational TypeScript building blocks: Option, Result, Exception hierarchy, Callback wrapper, and small utilities.

Readme

@armadacore/essentials

npm version license node

This library exists because I wanted Rust's robustness and explicit control flow in TypeScript. TypeScript's type system is strong enough to express "this value might be missing" or "this call might fail" — but the language itself doesn't force you to handle those cases. null, undefined, and thrown exceptions slip through type signatures and surface as runtime bugs. essentials brings the patterns that solve this in Rust — Option, Result, typed exceptions — to TypeScript in a form that the compiler actually enforces.

The problem this solves

In an average TypeScript codebase, three things tend to go wrong silently:

  1. Absence is invisible. A function returns User | null or User | undefined. The caller forgets the check. The bug shows up in production.
  2. Failure is invisible. A function throws. The signature says : User. Nothing in the type system tells the caller that this call can blow up, or with what.
  3. Errors lose context. An exception bubbles up, gets re-thrown, and somewhere along the way the original cause is lost — leaving you with a stack trace that points nowhere useful.

essentials makes all three of these explicit at the type level. You can't accidentally ignore an absent value, you can't accidentally ignore a failure, and you can't accidentally drop the cause of an error.

What you get

  • Option<T> — a value that is either Some(value) or None. Replaces T | null and T | undefined in your domain types. The compiler forces you to handle both branches before you can touch the value.
  • Result<T> — a value that is either Ok(value) or Err(exception). Replaces "this function throws". The failure becomes part of the return type, with a fixed Exception error channel so handling stays uniform.
  • Exception — a typed error hierarchy with HTTP-status awareness, an info discriminator, and proper cause propagation. Built so you can throw, catch, re-wrap, and serialize without losing the original failure.
  • Callback<T> — an Option-shaped wrapper for optional function values, so "the consumer might or might not have provided a handler" stops being a special case.

All public API is documented inline via TSDoc — IDE hover shows the full contract per symbol.

The benefit, in one snippet

// Before — the compiler is fine with all of this. Production isn't.
const findUser = (id: string): User | null => { /* ... */ };

const user = findUser(id);
console.log(user.name);   // runtime: Cannot read properties of null

// After — the compiler refuses to let you ignore the absent case.
const findUser = (id: string): IOption<User> => { /* ... */ };

const userOption = findUser(id);
userOption.onSome((user) => console.log(user.name));
userOption.onNone(() => console.log("not found"));

The same shift applies to fallible operations (Result instead of throw) and to error handling (Exception instead of bare Error). The pattern is always the same: make the failure mode part of the type, so the compiler enforces handling.

Documentation

Full documentation lives in the project wiki — start there for the per-building-block pages, common patterns and the wire-format / cross-monad reference.

Every public symbol is also annotated with TSDoc — your IDE hover shows the same contract that the wiki documents.

Install

npm install @armadacore/essentials

Requires Node.js >=20 and TypeScript ~5.7.

License

See LICENSE.