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

@neotales/results

v0.0.0-alpha.0

Published

Result helpers for returning success or failure values without throwing.

Readme

@neotales/results

Overview

@neotales/results provides explicit Result<T, E> success and failure values for code that should not use exceptions as normal control flow. It has no runtime dependencies and works in Deno, Node.js, Bun, browsers, and Cloudflare Workers.

Installation

deno add jsr:@neotales/results
npm install @neotales/results

Usage

import { all, fail, fromNullable, ok, tryCatch, tryCatchAsync } from "@neotales/results";

const count = ok(42).map((value) => value + 1);
const fallback = fail<number>(new Error("missing")).orDefault(0);

const parsed = tryCatch(() => JSON.parse('{"name":"neo"}') as { name: string });
const loaded = await tryCatchAsync(async () => ({ id: 1 }));
const requiredId = fromNullable(loaded.value?.id, new Error("missing id"));
const ids = all([ok(1), ok(2)]);

parsed.match(
  (value) => value.name,
  (error) => error.message,
);

Composition

import { fail, ok } from "@neotales/results";

const value = ok(2)
  .andThen((number) => ok(number + 1))
  .map((number) => number * 2);
// Result containing 6

const recovered = fail<number, Error>(new Error("offline")).orElse((error) => ok(error.message));
// Result containing "offline"

and, andThen, or, orElse, and map preserve both success and failure types. match converts either branch into one output type. fromNullable and fromPredicate create results from common validation branches. all and allAsync collect success values, stopping at the first failure. orThrow, expect, and expectError are boundary helpers for APIs that require exceptions. Use ok() and failed() when TypeScript should narrow value or error.

Async Boundaries

tryCatch and tryCatchAsync convert arbitrary thrown or rejected values into Error failures. resolve() converts a result into a regular promise, while toPromise(onFulfilled, onRejected) follows promise recovery semantics: a provided rejection handler resolves with its return value; without one, the failure remains rejected.

API

| Export | Description | | ---------------------------------------- | ---------------------------------------------- | | Result, Ok, Failure, EmptyResult | Result classes. | | ok, fail, empty, failAsError | Result factories. | | fromNullable, fromPredicate | Result factories for validation. | | all, allAsync | Collect success values or the first failure. | | match | Top-level result matcher. | | tryCatch, tryCatchAsync | Exception and rejection capture helpers. | | ResultError | Error thrown by invalid unwrapping operations. |

License

MIT