Skip to main content
Module

x/ahh/mod.ts>R.fn

Idiomatic type-safety structures for TypeScript.
Go to Latest
method R.fn
import { R } from "https://deno.land/x/ahh@v0.10.0/mod.ts";

Calls f and returns the result as an Ok, or returns an Err if it throws.

Examples

import { R } from "./mod.ts";

console.log(R.fn(() => 1)); // 1
console.log(R.fn(() => { throw Error(); })); // Error()

Type Parameters

T
E extends Error

Parameters

f: () => T