Skip to main content
Deno 2 is finally here 🎉️
Learn more

Safe code in deno made simple.

Usage

Depending on which feature(s) you are looking for, import the files that you need. For example, if we were looking to use Results depending on whether a string started with "a", we could do.

// you'll want to add a version to this
import { Result, Ok, Err } from "https://deno.land/x/ahh@vX.Y.Z/result.ts";

function mustStartWithA(str: string): Result<string, string> {
  if (str.startsWith("a")) {
    return Ok(str);
  } else {
    return Err("string must start with `\"a\"`".);
  }
}

const ok = mustStartWithA("abc");
const err = mustStartWithA("cba");

Licence

This is licenced under MIT; you can find out more in the provided LICENCE file.