fromNullable
import { fromNullable } from "https://raw.githubusercontent.com/baetheus/fun/main/option.ts";
The fromNullable function takes a potentially null or undefined value and maps null or undefined to None and non-null and non-undefined values to Some<NonNullable>.
@example
import * as O from "./option.ts";
const a: number | undefined = undefined;
const b: number | undefined = 2;
const c = [1, 2, 3];
const result1 = O.fromNullable(a); // None
const result2 = O.fromNullable(b); // Some<number>
const result3 = O.fromNullable(c[3]); // None