import { Option } from "https://deno.land/x/eitherway@0.10.0/lib/core/option.ts";
const { from } = Option;
Alias for Option()
Examples
Example 1
Example 1
import { assert } from "./assert.ts";
import { Option, None, Some } from "./option.ts";
const str: string | undefined = "thing";
const undef: string | undefined = undefined;
const some: Option<string> = Option.from(str);
const none: Option<string> = Option.from(undef);
assert(some instanceof Option === true);
assert(none instanceof Option === true);
assert(some.isSome() === true);
assert(none.isNone() === true);
Parameters
value: T