import { Result } from "https://deno.land/x/eitherway@0.10.0/lib/core/result.ts";
const { from } = Result;
Use this to lift the result of an infallible function into a Result
context.
In case, the supplied function panics, an exception is thrown, wrapping the original exception.
Examples
Example 1
Example 1
import { assert } from "./assert.ts";
import { Err, Ok, Result } from "./mod.ts";
const produceArr = () => [1,2,3];
const res = Result.from(produceArr);
assert(res.isOk());
Parameters
fn: () => T