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

true-myth

v9.3.1

Published

A library for safe functional programming in JavaScript, with first-class support for TypeScript

Downloads

1,682,845

Readme

Overview

True Myth provides standard, type-safe wrappers and helper functions to help you with three extremely common cases in programming:

  • not having a value
  • having a result where you need to deal with either success or failure
  • having an asynchronous operation which may fail

You could implement all of these yourself – it's not hard! – but it's much easier to just have one extremely well-tested library you can use everywhere to solve this problem once and for all.

See the docs for setup, guides, and API docs!

Contents

Requirements

  • TS 5.3+
  • tsconfig.json:
    • moduleResolution: use "Node16" or later
    • strict: true
  • package.json
    • type: "module" (or else use import() to import True Myth into a commonJS build)

For details on using a pure ES modules package in TypeScript, see the TypeScript handbook's guide.

Compatibility

This project follows the current draft of the Semantic Versioning for TypeScript Types specification.

  • Currently supported TypeScript versions: 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, and 5.9
  • Compiler support policy: simple majors
  • Public API: all published, documented types not in a -private module and not marked as @internal or @private are public

Basic bundle size info

Size of the ESM build without tree-shaking (yes, these are in bytes: this is a pretty small library!):

| file | size (B) | terser[^terser] (B) | terser and brotli[^brotli] (B) | | ------------------ | -------- | ------------------- | ------------------------------ | | -private/utils.js | 888 | 321 | 166 | | index.js | 644 | 352 | 122 | | maybe.js | 18872 | 3637 | 908 | | result.js | 15274 | 3927 | 972 | | standard-schema.js | 5975 | 762 | 317 | | task/delay.js | 3901 | 649 | 259 | | task.js | 54755 | 7448 | 2025 | | test-support.js | 473 | 142 | 89 | | toolbelt.js | 3739 | 890 | 277 | | unit.js | 656 | 58 | 57 | | total[^total] | 105177 | 18186 | 5192 |

Notes:

  • The unmodified size includes comments.

  • Thus, running through Terser gets us a much more realistic size: about 18.1KB to parse.

  • The total size across the wire of the whole library will be ~5.2KB.

  • This is all tree-shakeable to a significant degree: you should only have to “pay for” the types and functions you actually use, directly or indirectly. If your production bundle does not import or use anything from true-myth/test-support, you will not pay for it, for example. However, some parts of the library do depend directly on other parts: for example, toolbelt uses exports from result and maybe, and Task makes extensive use of Result under the hood.

    In detail, here are the dependencies of each module:

    | Module | Depends on | | -------------------- | ------------------------------------------------------------ | | index.js | All, but as tree-shakeable as possible | | maybe.js | unit.js, -private/utils.js | | result.js | unit.js, -private/utils.js | | standard-schema.js | task.js, result.js | | task.js | result.js, unit.js, task/delay.js, -private/utils.js | | task/delay.js | None | | test-support.js | maybe.js, result.js | | toolbelt.js | maybe.js, result.js, -private/utils.js |

[^terser]: Using terser 5.37.0 with --compress --mangle --mangle-props.

[^brotli]: Generated by running gzip -kq11 on the result of the terser invocation.

[^total]: This is just the sum of the previous lines. Real-world bundle size is a function of what you actually use, how your bundler handles tree-shaking, and how the results of bundling compresses. Notice that sufficiently small files can end up larger after compression; this stops being an issue once part of a bundle.

Inspiration

The design of True Myth draws heavily on prior art; essentially nothing of this is original – perhaps excepting the choice to make Maybe.of handle null and undefined in constructing the types. In particular, however, True Myth draws particular inspiration from: