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()
Parameters
f: () => T