import { Result } from "https://deno.land/x/eitherway@0.10.0/lib/core/result.ts";
const { fromFallible } = Result;
Use this to lift the result of a fallible function into a Result
context.
Examples
Example 1
Example 1
import { assert } from "./assert.ts";
import { Err, Ok, Result } from "./mod.ts";
const castToErr = <E>(e: unknown): E => e as E;
const produceArr = () => [1,2,3];
const res: Result<number[], TypeError> = Result.fromFallible(produceArr, castToErr<TypeError>);
assert(res.isOk());