fromNullable
import { fromNullable } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/either.ts";Convert a nullable value to an Either. If the value is null or undefined, it becomes a Left with the result of calling the error function. Otherwise, it becomes a Right with the non-null value.
@example
import * as E from "./either.ts";
const parseNumber = E.fromNullable(() => "Value is null or undefined");
const result1 = parseNumber(42); // Right(42)
const result2 = parseNumber(null); // Left("Value is null or undefined")
const result3 = parseNumber(undefined); // Left("Value is null or undefined")